On 26 February 2013 15:29, Jeff Sickel wrote: > But if the X11 port does expect EBADF on the EOF, then I'd expect > it to break. > It breaks anyway: http://lists.opensuse.org/opensuse-bugs/2012-08/msg02390.html Note, however, that the EBADF in that example is on the output side (and outputs are always marked as available in APE's select). More important, let's look at the Linux source code, since that will do as an example: http://lxr.linux.no/linux+v2.6.39/fs/select.c#L595 (mind yer lunch!). It generates EBADF only when a file descriptor in the read or write sets isn't open. If APE's select does the same, it will be fine, without breaking Python's pipes. In that loop i from 0 to OPEN_MAX-1, on read and write sides, it should check each f in the read and write sets for (f->flags&FD_ISOPEN) != 0, or set EBADF and return -1.