summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-07-13 23:59:35 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-07-13 23:59:35 (GMT)
commit9f28a039f6b0d320c60a605e42618fdbacd14908 (patch)
tree86bf430c12066d37a895c14a744972b1015051b2 /Modules/selectmodule.c
parent8c46b30e0a9dc91b56cec1d1204069c47a64f217 (diff)
downloadcpython-9f28a039f6b0d320c60a605e42618fdbacd14908.zip
cpython-9f28a039f6b0d320c60a605e42618fdbacd14908.tar.gz
cpython-9f28a039f6b0d320c60a605e42618fdbacd14908.tar.bz2
Use PyObject_AsFileDescriptor
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 23b7036..8f73d38 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -96,31 +96,9 @@ list2set(PyObject *list, fd_set *set, pylist fd2obj[FD_SETSIZE + 3])
return -1;
Py_INCREF(o);
+ v = PyObject_AsFileDescriptor( o );
+ if (v == -1) goto finally;
- 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;
-
- 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 */