mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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:
parent
160e819a1d
commit
ea9c0dd2c2
6 changed files with 29 additions and 20 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue