Skip to content

Commit 45c5d4d

Browse files
author
nascheme
committed
Don't use PyNumber_Float() since it's is nearly useless. Instead, rely on
PyFloat_AsDouble to generate a good error message. git-svn-id: http://svn.python.org/projects/python/trunk@29747 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 43f1a01 commit 45c5d4d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Modules/selectmodule.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,9 @@ select_select(PyObject *self, PyObject *args)
214214
return NULL;
215215
}
216216
else {
217-
tout = PyNumber_Float(tout);
218-
if (!tout)
217+
timeout = PyFloat_AsDouble(tout);
218+
if (timeout == -1 && PyErr_Occurred())
219219
return NULL;
220-
timeout = PyFloat_AS_DOUBLE(tout);
221-
Py_DECREF(tout);
222220
if (timeout > (double)LONG_MAX) {
223221
PyErr_SetString(PyExc_OverflowError,
224222
"timeout period too long");

0 commit comments

Comments
 (0)