summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2004-08-07 17:21:27 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2004-08-07 17:21:27 (GMT)
commite5dd162a07ccf49a49740edfb535652b184266c3 (patch)
tree9825dc840291b2924269cd7a244ffe44ae08f409 /Modules/selectmodule.c
parentb6d9fc38e8b12fdbdb082acf23dc63a7809c3836 (diff)
downloadcpython-e5dd162a07ccf49a49740edfb535652b184266c3.zip
cpython-e5dd162a07ccf49a49740edfb535652b184266c3.tar.gz
cpython-e5dd162a07ccf49a49740edfb535652b184266c3.tar.bz2
[Bug #923315] Produce correct result on AIX
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 26b918e..81c9e3c 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -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;