From: Andrew M. Kuchling Date: Sat, 7 Aug 2004 17:21:27 +0000 (+0000) Subject: [Bug #923315] Produce correct result on AIX X-Git-Tag: v2.4a3~365 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e5dd162a07ccf49a49740edfb535652b184266c3;p=thirdparty%2FPython%2Fcpython.git [Bug #923315] Produce correct result on AIX --- diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 26b918e3ceab..81c9e3cd9847 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;