test_poll.py currently fails on Monterey (64-bit AIX) because of a difference in the system poll() function as compared to Linux. On Linux (and as required by the Signle Unix Specification: http://www.opengroup.org/onlinepubs/007908799/xsh/poll.html) if you "poll()" a bogus file descriptor you get a POLLNVAL return value in the 'revents' field of the structure sent to poll(). This is tested like so in test_poll.py: # returns NVAL for invalid file descriptor FD = 42 try: os.close(FD) except OSError: pass p = select.poll() p.register(FD) r = p.poll() assert r[0] == (FD, select.POLLNVAL) Monterey decided to return -1 instead. [Aside: However, 'revents's type is "short" so the Python interface to poll() (using PyInt_FromLong) actually interprets that as -32768 instead.] Questions: 1. Can anybody offer an opinion if this is Python's or Monterey's problem? 2. Can anybody tell me where I can browse the POSIX spec to see if this breaks POSIX compliance as well? 3. Could someone (Vladimir?) run this test program on a normal AIX box and tell me what the output is (does the return value == POLLNVAL?)? ---------------------------------------------------------------------- #include <stdio.h> #include <poll.h> #define NFDS 1 int main(void) { struct pollfd ufds[NFDS]; int pollResult; printf("hello\n"); /* poll for any event on a bogus file descriptor */ ufds[0].fd = 42; ufds[0].events = POLLIN | POLLPRI | POLLOUT; pollResult = poll(ufds, NFDS, -1); if (pollResult != 1) { printf("*** poll result was %d, I expected 1.\n", pollResult); } printf("ufds[0].revents = %hd\n", ufds[0].revents); printf("POLLNVAL = %ld\n", POLLNVAL); return 0; } ---------------------------------------------------------------------- Thanks, Trent -- Trent Mick TrentM@ActiveState.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4