summaryrefslogtreecommitdiffstats
path: root/Modules/timemodule.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-10-18 09:09:57 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-18 09:09:57 (GMT)
commitbe4e9cc769aac3cb46670c049b9f21e412be53d1 (patch)
treececaf808562d39817ecaa52ab0056f6229fb0624 /Modules/timemodule.c
parent95602b368b87da3702a0f340ded2a23e823bb104 (diff)
downloadcpython-be4e9cc769aac3cb46670c049b9f21e412be53d1.zip
cpython-be4e9cc769aac3cb46670c049b9f21e412be53d1.tar.gz
cpython-be4e9cc769aac3cb46670c049b9f21e412be53d1.tar.bz2
[3.6] bpo-31806: Use _PyTime_ROUND_TIMEOUT for the timeout argument parsing in more functions (GH-4026) (#4032)
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. (cherry picked from commit 59af94fa61bf90adbe624508e909b5d6ef6e8464)
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 0abe569..dba3d04 100644
--- a/Modules/timemodule.c
+++ b/Modules/timemodule.c
@@ -225,7 +225,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,