@@ -221,7 +221,7 @@ select_select(PyObject *self, PyObject *args)
221221 return NULL ;
222222 }
223223
224- if (_PyTime_AsTimeval (timeout , & tv , _PyTime_ROUND_CEILING ) == -1 )
224+ if (_PyTime_AsTimeval (timeout , & tv , _PyTime_ROUND_UP ) == -1 )
225225 return NULL ;
226226 if (tv .tv_sec < 0 ) {
227227 PyErr_SetString (PyExc_ValueError , "timeout must be non-negative" );
@@ -282,7 +282,7 @@ select_select(PyObject *self, PyObject *args)
282282 n = 0 ;
283283 break ;
284284 }
285- _PyTime_AsTimeval_noraise (timeout , & tv , _PyTime_ROUND_CEILING );
285+ _PyTime_AsTimeval_noraise (timeout , & tv , _PyTime_ROUND_UP );
286286 /* retry select() with the recomputed timeout */
287287 }
288288 } while (1 );
@@ -540,15 +540,15 @@ poll_poll(pollObject *self, PyObject *args)
540540 }
541541 else {
542542 if (_PyTime_FromMillisecondsObject (& timeout , timeout_obj ,
543- _PyTime_ROUND_CEILING ) < 0 ) {
543+ _PyTime_ROUND_UP ) < 0 ) {
544544 if (PyErr_ExceptionMatches (PyExc_TypeError )) {
545545 PyErr_SetString (PyExc_TypeError ,
546546 "timeout must be an integer or None" );
547547 }
548548 return NULL ;
549549 }
550550
551- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
551+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
552552 if (ms < INT_MIN || ms > INT_MAX ) {
553553 PyErr_SetString (PyExc_OverflowError , "timeout is too large" );
554554 return NULL ;
@@ -576,7 +576,7 @@ poll_poll(pollObject *self, PyObject *args)
576576 do {
577577 Py_BEGIN_ALLOW_THREADS
578578 errno = 0 ;
579- poll_result = poll (self -> ufds , self -> ufd_len , ms > 0 ? (int )ms : -1 );
579+ poll_result = poll (self -> ufds , self -> ufd_len , (int )ms );
580580 Py_END_ALLOW_THREADS
581581
582582 if (errno != EINTR )
@@ -594,7 +594,7 @@ poll_poll(pollObject *self, PyObject *args)
594594 poll_result = 0 ;
595595 break ;
596596 }
597- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
597+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
598598 /* retry poll() with the recomputed timeout */
599599 }
600600 } while (1 );
@@ -896,15 +896,15 @@ devpoll_poll(devpollObject *self, PyObject *args)
896896 }
897897 else {
898898 if (_PyTime_FromMillisecondsObject (& timeout , timeout_obj ,
899- _PyTime_ROUND_CEILING ) < 0 ) {
899+ _PyTime_ROUND_UP ) < 0 ) {
900900 if (PyErr_ExceptionMatches (PyExc_TypeError )) {
901901 PyErr_SetString (PyExc_TypeError ,
902902 "timeout must be an integer or None" );
903903 }
904904 return NULL ;
905905 }
906906
907- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
907+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
908908 if (ms < -1 || ms > INT_MAX ) {
909909 PyErr_SetString (PyExc_OverflowError , "timeout is too large" );
910910 return NULL ;
@@ -941,7 +941,7 @@ devpoll_poll(devpollObject *self, PyObject *args)
941941 poll_result = 0 ;
942942 break ;
943943 }
944- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
944+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
945945 dvp .dp_timeout = (int )ms ;
946946 /* retry devpoll() with the recomputed timeout */
947947 }
@@ -1513,15 +1513,15 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
15131513 /* epoll_wait() has a resolution of 1 millisecond, round towards
15141514 infinity to wait at least timeout seconds. */
15151515 if (_PyTime_FromSecondsObject (& timeout , timeout_obj ,
1516- _PyTime_ROUND_CEILING ) < 0 ) {
1516+ _PyTime_ROUND_UP ) < 0 ) {
15171517 if (PyErr_ExceptionMatches (PyExc_TypeError )) {
15181518 PyErr_SetString (PyExc_TypeError ,
15191519 "timeout must be an integer or None" );
15201520 }
15211521 return NULL ;
15221522 }
15231523
1524- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
1524+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
15251525 if (ms < INT_MIN || ms > INT_MAX ) {
15261526 PyErr_SetString (PyExc_OverflowError , "timeout is too large" );
15271527 return NULL ;
@@ -1565,7 +1565,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
15651565 nfds = 0 ;
15661566 break ;
15671567 }
1568- ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_CEILING );
1568+ ms = _PyTime_AsMilliseconds (timeout , _PyTime_ROUND_UP );
15691569 /* retry epoll_wait() with the recomputed timeout */
15701570 }
15711571 } while (1 );
@@ -2128,7 +2128,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
21282128 }
21292129 else {
21302130 if (_PyTime_FromSecondsObject (& timeout ,
2131- otimeout , _PyTime_ROUND_CEILING ) < 0 ) {
2131+ otimeout , _PyTime_ROUND_UP ) < 0 ) {
21322132 PyErr_Format (PyExc_TypeError ,
21332133 "timeout argument must be a number "
21342134 "or None, got %.200s" ,
0 commit comments