Index: socketmodule.c =================================================================== --- socketmodule.c (revision 46167) +++ socketmodule.c (working copy) @@ -416,8 +416,9 @@ #define IS_SELECTABLE(s) 1 #else /* POSIX says selecting file descriptors beyond FD_SETSIZE - has undefined behaviour. */ -#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE) + has undefined behaviour, however, we only ever call it if s->sock_timeout is + positive. */ +#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE || s->sock_timeout <= 0.0) #endif static PyObject*