diff options
Diffstat (limited to 'Modules/socketmodule.c')
-rwxr-xr-x | Modules/socketmodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index f220c26..d4f2098 100755 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -789,6 +789,17 @@ internal_select(PySocketSockObject *s, int writing, _PyTime_t interval, ms = _PyTime_AsMilliseconds(interval, _PyTime_ROUND_CEILING); assert(ms <= INT_MAX); + /* On some OSes, typically BSD-based ones, the timeout parameter of the + poll() syscall, when negative, must be exactly INFTIM, where defined, + or -1. See issue 37811. */ + if (ms < 0) { +#ifdef INFTIM + ms = INFTIM; +#else + ms = -1; +#endif + } + Py_BEGIN_ALLOW_THREADS; n = poll(&pollfd, 1, (int)ms); Py_END_ALLOW_THREADS; |