diff options
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 2764bd6..06be822 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -810,7 +810,9 @@ internal_select(PySocketSockObject *s, int writing, PyTime_t interval, /* s->sock_timeout is in seconds, timeout in ms */ ms = _PyTime_AsMilliseconds(interval, _PyTime_ROUND_CEILING); - assert(ms <= INT_MAX); + if (ms > INT_MAX) { + 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, @@ -822,6 +824,7 @@ internal_select(PySocketSockObject *s, int writing, PyTime_t interval, ms = -1; #endif } + assert(INT_MIN <= ms && ms <= INT_MAX); Py_BEGIN_ALLOW_THREADS; n = poll(&pollfd, 1, (int)ms); |