mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
c6a726d061
commit
131a6414dd
3 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue