diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/timemodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 636d4ad..4dc82a0 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -141,6 +141,11 @@ time_sleep(PyObject *self, PyObject *args) double secs; if (!PyArg_ParseTuple(args, "d:sleep", &secs)) return NULL; + if (secs < 0) { + PyErr_SetString(PyExc_ValueError, + "sleep length must be non-negative"); + return NULL; + } if (floatsleep(secs) != 0) return NULL; Py_INCREF(Py_None); |