summaryrefslogtreecommitdiff
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-11-01 17:43:07 +0200
committerGitHub <noreply@github.com>2017-11-01 17:43:07 +0200
commitce51890894be46f8f9d991a1d0ea1455fc41ccdc (patch)
tree61aa6d8b179dd6739a1cf3edaba8e3879ceeec08 /Modules/selectmodule.c
parent87c66e46ce2c929540a9a91bbe25d1840d194475 (diff)
downloadcpython-git-ce51890894be46f8f9d991a1d0ea1455fc41ccdc.tar.gz
bpo-31893: Fix a backporting error in 8cbf4e10646c3f5b8f0d274c2d7dea5bb6305f57. (#4219)
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 6cd32cd8a9..1dec6a120d 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -1352,9 +1352,12 @@ kqueue_event_init(kqueue_event_Object *self, PyObject *args, PyObject *kwds)
if (PyInt_Check(pfd)) {
self->e.ident = PyInt_AsUnsignedLongMask(pfd);
}
- else {
- if (PyInt_Check(pfd) || PyLong_Check(pfd)) {
- self->e.ident = PyLong_AsSize_t(pfd);
+ else if (PyLong_Check(pfd)) {
+#if defined(HAVE_LONG_LONG) && (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG)
+ self->e.ident = PyLong_AsUnsignedLongLongMask(pfd);
+#else
+ self->e.ident = PyLong_AsUnsignedLongMask(pfd);
+#endif
}
else {
self->e.ident = PyObject_AsFileDescriptor(pfd);