[3.6] bpo-31786: Make functions in the select module blocking when ti… · python/cpython@95602b3 (original) (raw)
`@@ -213,15 +213,15 @@ select_select(PyObject *self, PyObject *args)
`
213
213
`tvp = (struct timeval *)NULL;
`
214
214
`else {
`
215
215
`if (_PyTime_FromSecondsObject(&timeout, timeout_obj,
`
216
``
`-
_PyTime_ROUND_CEILING) < 0) {
`
``
216
`+
_PyTime_ROUND_TIMEOUT) < 0) {
`
217
217
`if (PyErr_ExceptionMatches(PyExc_TypeError)) {
`
218
218
`PyErr_SetString(PyExc_TypeError,
`
219
219
`"timeout must be a float or None");
`
220
220
` }
`
221
221
`return NULL;
`
222
222
` }
`
223
223
``
224
``
`-
if (_PyTime_AsTimeval(timeout, &tv, _PyTime_ROUND_CEILING) == -1)
`
``
224
`+
if (_PyTime_AsTimeval(timeout, &tv, _PyTime_ROUND_TIMEOUT) == -1)
`
225
225
`return NULL;
`
226
226
`if (tv.tv_sec < 0) {
`
227
227
`PyErr_SetString(PyExc_ValueError, "timeout must be non-negative");
`
`@@ -543,15 +543,15 @@ poll_poll(pollObject *self, PyObject *args)
`
543
543
` }
`
544
544
`else {
`
545
545
`if (_PyTime_FromMillisecondsObject(&timeout, timeout_obj,
`
546
``
`-
_PyTime_ROUND_CEILING) < 0) {
`
``
546
`+
_PyTime_ROUND_TIMEOUT) < 0) {
`
547
547
`if (PyErr_ExceptionMatches(PyExc_TypeError)) {
`
548
548
`PyErr_SetString(PyExc_TypeError,
`
549
549
`"timeout must be an integer or None");
`
550
550
` }
`
551
551
`return NULL;
`
552
552
` }
`
553
553
``
554
``
`-
ms = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING);
`
``
554
`+
ms = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_TIMEOUT);
`
555
555
`if (ms < INT_MIN || ms > INT_MAX) {
`
556
556
`PyErr_SetString(PyExc_OverflowError, "timeout is too large");
`
557
557
`return NULL;
`
`@@ -899,15 +899,15 @@ devpoll_poll(devpollObject *self, PyObject *args)
`
899
899
` }
`
900
900
`else {
`
901
901
`if (_PyTime_FromMillisecondsObject(&timeout, timeout_obj,
`
902
``
`-
_PyTime_ROUND_CEILING) < 0) {
`
``
902
`+
_PyTime_ROUND_TIMEOUT) < 0) {
`
903
903
`if (PyErr_ExceptionMatches(PyExc_TypeError)) {
`
904
904
`PyErr_SetString(PyExc_TypeError,
`
905
905
`"timeout must be an integer or None");
`
906
906
` }
`
907
907
`return NULL;
`
908
908
` }
`
909
909
``
910
``
`-
ms = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING);
`
``
910
`+
ms = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_TIMEOUT);
`
911
911
`if (ms < -1 || ms > INT_MAX) {
`
912
912
`PyErr_SetString(PyExc_OverflowError, "timeout is too large");
`
913
913
`return NULL;
`
`@@ -1514,7 +1514,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
`
1514
1514
`/* epoll_wait() has a resolution of 1 millisecond, round towards
`
1515
1515
` infinity to wait at least timeout seconds. */
`
1516
1516
`if (_PyTime_FromSecondsObject(&timeout, timeout_obj,
`
1517
``
`-
_PyTime_ROUND_CEILING) < 0) {
`
``
1517
`+
_PyTime_ROUND_TIMEOUT) < 0) {
`
1518
1518
`if (PyErr_ExceptionMatches(PyExc_TypeError)) {
`
1519
1519
`PyErr_SetString(PyExc_TypeError,
`
1520
1520
`"timeout must be an integer or None");
`
`@@ -2129,7 +2129,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
`
2129
2129
` }
`
2130
2130
`else {
`
2131
2131
`if (_PyTime_FromSecondsObject(&timeout,
`
2132
``
`-
otimeout, _PyTime_ROUND_CEILING) < 0) {
`
``
2132
`+
otimeout, _PyTime_ROUND_TIMEOUT) < 0) {
`
2133
2133
`PyErr_Format(PyExc_TypeError,
`
2134
2134
`"timeout argument must be a number "
`
2135
2135
`"or None, got %.200s",
`