diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 01:49:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2015-03-30 01:49:14 (GMT) |
commit | 869e1778c0bcfc0928701c6ae0703934359d036b (patch) | |
tree | 231b2e09d453cca2ce5bf462ffb91f0f7303f3c0 /Modules/socketmodule.c | |
parent | bcdd777d3c01a6db3b4357922663624ef617e65a (diff) | |
download | cpython-869e1778c0bcfc0928701c6ae0703934359d036b.zip cpython-869e1778c0bcfc0928701c6ae0703934359d036b.tar.gz cpython-869e1778c0bcfc0928701c6ae0703934359d036b.tar.bz2 |
Issue #22117: Replace usage of _PyTime_ROUND_UP with _PyTime_ROUND_CEILING
All these functions only accept positive timeouts, so this change has no effect
in practice.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 513405e..a6c47ae 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -633,7 +633,7 @@ internal_select_ex(PySocketSockObject *s, int writing, _PyTime_t interval) pollfd.events = writing ? POLLOUT : POLLIN; /* s->sock_timeout is in seconds, timeout in ms */ - timeout = _PyTime_AsMilliseconds(interval, _PyTime_ROUND_UP); + timeout = _PyTime_AsMilliseconds(interval, _PyTime_ROUND_CEILING); assert(timeout <= INT_MAX); timeout_int = (int)timeout; @@ -641,7 +641,7 @@ internal_select_ex(PySocketSockObject *s, int writing, _PyTime_t interval) n = poll(&pollfd, 1, timeout_int); Py_END_ALLOW_THREADS; #else - _PyTime_AsTimeval_noraise(interval, &tv, _PyTime_ROUND_UP); + _PyTime_AsTimeval_noraise(interval, &tv, _PyTime_ROUND_CEILING); FD_ZERO(&fds); FD_SET(s->sock_fd, &fds); @@ -2191,7 +2191,8 @@ socket_parse_timeout(_PyTime_t *timeout, PyObject *timeout_obj) return 0; } - if (_PyTime_FromSecondsObject(timeout, timeout_obj, _PyTime_ROUND_UP) < 0) + if (_PyTime_FromSecondsObject(timeout, + timeout_obj, _PyTime_ROUND_CEILING) < 0) return -1; if (*timeout < 0) { @@ -2200,10 +2201,10 @@ socket_parse_timeout(_PyTime_t *timeout, PyObject *timeout_obj) } #ifdef MS_WINDOWS - overflow = (_PyTime_AsTimeval(timeout, &tv, _PyTime_ROUND_UP) < 0); + overflow = (_PyTime_AsTimeval(timeout, &tv, _PyTime_ROUND_CEILING) < 0); #endif #ifndef HAVE_POLL - timeout = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_UP); + timeout = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING); overflow = (timeout > INT_MAX); #endif if (overflow) { @@ -2452,7 +2453,7 @@ internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen, struct timeval tv; int conv; - _PyTime_AsTimeval_noraise(s->sock_timeout, &tv, _PyTime_ROUND_UP); + _PyTime_AsTimeval_noraise(s->sock_timeout, &tv, _PyTime_ROUND_CEILING); Py_BEGIN_ALLOW_THREADS FD_ZERO(&fds); |