Mercurial > cpython-lru_cache-weakref
diff Modules/selectmodule.c @ 13593:df64cc0e84e2 legacy-trunk
Use PyObject_AsFileDescriptor
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Thu, 13 Jul 2000 23:59:35 +0000 |
| parents | 95b9ddb00352 |
| children | 8a063423e0b7 |
line wrap: on
line diff
--- a/Modules/selectmodule.c Thu Jul 13 23:58:16 2000 +0000 +++ b/Modules/selectmodule.c Thu Jul 13 23:59:35 2000 +0000 @@ -96,31 +96,9 @@ return -1; Py_INCREF(o); - - if (PyInt_Check(o)) { - v = PyInt_AsLong(o); - } - else if ((meth = PyObject_GetAttrString(o, "fileno")) != NULL) - { - PyObject *fno = PyEval_CallObject(meth, NULL); - Py_DECREF(meth); - if (fno == NULL) - goto finally; + v = PyObject_AsFileDescriptor( o ); + if (v == -1) goto finally; - if (!PyInt_Check(fno)) { - PyErr_SetString(PyExc_TypeError, - "fileno method returned a non-integer"); - Py_DECREF(fno); - goto finally; - } - v = PyInt_AsLong(fno); - Py_DECREF(fno); - } - else { - PyErr_SetString(PyExc_TypeError, - "argument must be an int, or have a fileno() method."); - goto finally; - } #if defined(_MSC_VER) max = 0; /* not used for Win32 */ #else /* !_MSC_VER */
