diff -r bbfc65d05588 Lib/test/test_select.py --- a/Lib/test/test_select.py Thu Apr 07 10:48:29 2011 -0400 +++ b/Lib/test/test_select.py Thu Apr 07 21:06:59 2011 +0200 @@ -20,6 +20,7 @@ self.assertRaises(TypeError, select.select, [self.Nope()], [], []) self.assertRaises(TypeError, select.select, [self.Almost()], [], []) self.assertRaises(TypeError, select.select, [], [], [], "not a number") + self.assertRaises(ValueError, select.select, [], [], [], -1) def test_returned_list_identity(self): # See issue #8329 diff -r bbfc65d05588 Modules/selectmodule.c --- a/Modules/selectmodule.c Thu Apr 07 10:48:29 2011 -0400 +++ b/Modules/selectmodule.c Thu Apr 07 21:06:59 2011 +0200 @@ -234,6 +234,11 @@ "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;