]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Bug #923315] Produce correct result on AIX
authorAndrew M. Kuchling <amk@amk.ca>
Sat, 7 Aug 2004 17:21:27 +0000 (17:21 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Sat, 7 Aug 2004 17:21:27 +0000 (17:21 +0000)
Modules/selectmodule.c

index 26b918e3ceaba3bafd94c7cabe164f849600589d..81c9e3cd98478261f63f6dcd480584cdbecbca66 100644 (file)
@@ -511,7 +511,11 @@ poll_poll(pollObject *self, PyObject *args)
                        }
                        PyTuple_SET_ITEM(value, 0, num);
 
-                       num = PyInt_FromLong(self->ufds[i].revents);
+                       /* The &0xffff is a workaround for AIX.  'revents'
+                          is a 16-bit short, and IBM assigned POLLNVAL
+                          to be 0x8000, so the conversion to int results
+                          in a negative number. See SF bug #923315. */
+                       num = PyInt_FromLong(self->ufds[i].revents & 0xffff);
                        if (num == NULL) {
                                Py_DECREF(value);
                                goto error;