]> granicus.if.org Git - python/commitdiff
Fix and simplify error handling, silencing a compiler warning.
authorGeorg Brandl <georg@python.org>
Wed, 26 Mar 2008 12:57:47 +0000 (12:57 +0000)
committerGeorg Brandl <georg@python.org>
Wed, 26 Mar 2008 12:57:47 +0000 (12:57 +0000)
Modules/selectmodule.c

index de38fe60e510c14a19f284211d1da2a899403b3d..83a6538a411790fe22e1728a728223401cf405c5 100644 (file)
@@ -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;
 }