diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-09 21:49:58 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-09 21:49:58 (GMT) |
commit | 131a6414dd023d8bfa71a05e76030c1e0aaf2c1d (patch) | |
tree | 3c78a195f7e96ba91dfb185e1073ba166750d472 /Modules | |
parent | c6a726d061023abf0fdf7af41a3602b8f405d303 (diff) | |
download | cpython-131a6414dd023d8bfa71a05e76030c1e0aaf2c1d.zip cpython-131a6414dd023d8bfa71a05e76030c1e0aaf2c1d.tar.gz cpython-131a6414dd023d8bfa71a05e76030c1e0aaf2c1d.tar.bz2 |
Issue #11757: select.select() now raises ValueError when a negative timeout
is passed (previously, a select.error with EINVAL would be raised). Patch
by Charles-François Natali.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/selectmodule.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 65e1826..5aa67dd 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -234,6 +234,11 @@ select_select(PyObject *self, PyObject *args) "timeout period too long"); return NULL; } + if (timeout < 0) { + PyErr_SetString(PyExc_ValueError, + "timeout must be non-negative"); + return NULL; + } seconds = (long)timeout; timeout = timeout - (double)seconds; tv.tv_sec = seconds; |