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

@ -1651,9 +1651,7 @@ check_socket_and_wait_for_timeout(PySocketSockObject *s, int writing)
if (!_PyIsSelectable_fd(s->sock_fd))
return SOCKET_TOO_LARGE_FOR_SELECT;
/* 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);
FD_ZERO(&fds);
FD_SET(s->sock_fd, &fds);