summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-26 12:57:47 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-26 12:57:47 (GMT)
commit018a3622e8f0662fd3e82c2e1ad90d14131b1d3e (patch)
tree2a1c78da964373b751c407d5eb0d050c564c49b4 /Modules
parent8c78cc3b6c0a3e6e1580a3d67cefaabeb0721f32 (diff)
downloadcpython-018a3622e8f0662fd3e82c2e1ad90d14131b1d3e.zip
cpython-018a3622e8f0662fd3e82c2e1ad90d14131b1d3e.tar.gz
cpython-018a3622e8f0662fd3e82c2e1ad90d14131b1d3e.tar.bz2
Fix and simplify error handling, silencing a compiler warning.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/selectmodule.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index de38fe6..83a6538 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -991,6 +991,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
else if (dtimeout * 1000.0 > INT_MAX) {
PyErr_SetString(PyExc_OverflowError,
"timeout is too large");
+ return NULL;
}
else {
timeout = (int)(dtimeout * 1000.0);
@@ -1027,19 +1028,15 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
}
for (i = 0; i < nfds; i++) {
- etuple = Py_BuildValue("iI", evs[i].data.fd,
- evs[i].events);
+ etuple = Py_BuildValue("iI", evs[i].data.fd, evs[i].events);
if (etuple == NULL) {
+ Py_CLEAR(elist);
goto error;
}
PyList_SET_ITEM(elist, i, etuple);
}
- if (0) {
- error:
- Py_CLEAR(elist);
- Py_XDECREF(etuple);
- }
+ error:
PyMem_Free(evs);
return elist;
}