Kaydet (Commit) 018a3622 authored tarafından Georg Brandl's avatar Georg Brandl

Fix and simplify error handling, silencing a compiler warning.

üst 8c78cc3b
...@@ -991,6 +991,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds) ...@@ -991,6 +991,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
else if (dtimeout * 1000.0 > INT_MAX) { else if (dtimeout * 1000.0 > INT_MAX) {
PyErr_SetString(PyExc_OverflowError, PyErr_SetString(PyExc_OverflowError,
"timeout is too large"); "timeout is too large");
return NULL;
} }
else { else {
timeout = (int)(dtimeout * 1000.0); timeout = (int)(dtimeout * 1000.0);
...@@ -1027,19 +1028,15 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds) ...@@ -1027,19 +1028,15 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
} }
for (i = 0; i < nfds; i++) { for (i = 0; i < nfds; i++) {
etuple = Py_BuildValue("iI", evs[i].data.fd, etuple = Py_BuildValue("iI", evs[i].data.fd, evs[i].events);
evs[i].events);
if (etuple == NULL) { if (etuple == NULL) {
Py_CLEAR(elist);
goto error; goto error;
} }
PyList_SET_ITEM(elist, i, etuple); PyList_SET_ITEM(elist, i, etuple);
} }
if (0) { error:
error:
Py_CLEAR(elist);
Py_XDECREF(etuple);
}
PyMem_Free(evs); PyMem_Free(evs);
return elist; return elist;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment