Issue #22117: Fix usage of _PyTime_AsTimeval()

Add _PyTime_AsTimeval_noraise() function. Call it when it's not possible (or
not useful) to raise a Python exception on overflow.
This commit is contained in:
Victor Stinner 2015-03-30 02:51:13 +02:00
parent 160e819a1d
commit ea9c0dd2c2
6 changed files with 29 additions and 20 deletions

View file

@ -1405,11 +1405,8 @@ pysleep(_PyTime_t secs)
do {
#ifndef MS_WINDOWS
if (_PyTime_AsTimeval(secs, &timeout, _PyTime_ROUND_UP) < 0) {
PyErr_SetString(PyExc_OverflowError,
"delay doesn't fit into C timeval");
if (_PyTime_AsTimeval(secs, &timeout, _PyTime_ROUND_UP) < 0)
return -1;
}
Py_BEGIN_ALLOW_THREADS
err = select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &timeout);