summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2017-10-18 07:13:09 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-18 07:13:09 (GMT)
commit59af94fa61bf90adbe624508e909b5d6ef6e8464 (patch)
tree74ee9a80276bed8eb99229acf2fb071a1d341400 /Modules/timemodule.c
parentec12df1e6e4d03a0d22956355308df695a8dff36 (diff)
downloadcpython-59af94fa61bf90adbe624508e909b5d6ef6e8464.zip
cpython-59af94fa61bf90adbe624508e909b5d6ef6e8464.tar.gz
cpython-59af94fa61bf90adbe624508e909b5d6ef6e8464.tar.bz2
bpo-31806: Use _PyTime_ROUND_TIMEOUT for the timeout argument parsing in more functions (#4026)
Fix timeout rounding in time.sleep(), threading.Lock.acquire() and socket.socket.settimeout() to round correctly negative timeouts between -1.0 and 0.0. The functions now block waiting for events as expected. Previously, the call was incorrectly non-blocking.
Diffstat (limited to 'Modules/timemodule.c')
-rw-r--r--Modules/timemodule.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c
index 463f5c5..b5e168f 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -245,7 +245,7 @@ static PyObject *
time_sleep(PyObject *self, PyObject *obj)
{
_PyTime_t secs;
- if (_PyTime_FromSecondsObject(&secs, obj, _PyTime_ROUND_CEILING))
+ if (_PyTime_FromSecondsObject(&secs, obj, _PyTime_ROUND_TIMEOUT))
return NULL;
if (secs < 0) {
PyErr_SetString(PyExc_ValueError,