mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +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
|
@ -641,9 +641,7 @@ internal_select_ex(PySocketSockObject *s, int writing, _PyTime_t interval)
|
|||
n = poll(&pollfd, 1, timeout_int);
|
||||
Py_END_ALLOW_THREADS;
|
||||
#else
|
||||
/* conversion was already checked for overflow when
|
||||
the timeout was set */
|
||||
(void)_PyTime_AsTimeval(interval, &tv, _PyTime_ROUND_UP);
|
||||
_PyTime_AsTimeval_noraise(interval, &tv, _PyTime_ROUND_UP);
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(s->sock_fd, &fds);
|
||||
|
@ -2454,9 +2452,7 @@ internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen,
|
|||
struct timeval tv;
|
||||
int conv;
|
||||
|
||||
/* conversion was already checked for overflow when
|
||||
the timeout was set */
|
||||
(void)_PyTime_AsTimeval(s->sock_timeout, &tv, _PyTime_ROUND_UP);
|
||||
_PyTime_AsTimeval_noraise(s->sock_timeout, &tv, _PyTime_ROUND_UP);
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
FD_ZERO(&fds);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue