diff Modules/selectmodule.c @ 33007:9fb2e30f26be legacy-trunk

[Bug #923315] Produce correct result on AIX
author Andrew M. Kuchling <amk@amk.ca>
date Sat, 07 Aug 2004 17:21:27 +0000
parents f4a4ac7331ec
children 418a61ead11b
line wrap: on
line diff
--- a/Modules/selectmodule.c	Sat Aug 07 17:05:42 2004 +0000
+++ b/Modules/selectmodule.c	Sat Aug 07 17:21:27 2004 +0000
@@ -511,7 +511,11 @@
 			}
 			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;