]> granicus.if.org Git - python/commitdiff
Don't use PyNumber_Float() since it's is nearly useless. Instead, rely on
authorNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 18 Nov 2002 16:02:29 +0000 (16:02 +0000)
committerNeil Schemenauer <nascheme@enme.ucalgary.ca>
Mon, 18 Nov 2002 16:02:29 +0000 (16:02 +0000)
PyFloat_AsDouble to generate a good error message.

Modules/selectmodule.c

index 805dc1a61d1e7da69455dcf0beab9e51065f599b..0ff0b2cc16a4b0801a7672808c008a2593013d65 100644 (file)
@@ -214,11 +214,9 @@ select_select(PyObject *self, PyObject *args)
                return NULL;
        }
        else {
-               tout = PyNumber_Float(tout);
-               if (!tout)
+               timeout = PyFloat_AsDouble(tout);
+               if (timeout == -1 && PyErr_Occurred())
                        return NULL;
-               timeout = PyFloat_AS_DOUBLE(tout);
-               Py_DECREF(tout);
                if (timeout > (double)LONG_MAX) {
                        PyErr_SetString(PyExc_OverflowError,
                                        "timeout period too long");