diff -r 3fbfa61634de Modules/selectmodule.c --- a/Modules/selectmodule.c Thu Jul 19 00:14:35 2012 -0500 +++ b/Modules/selectmodule.c Thu Jul 19 15:52:38 2012 +0200 @@ -107,7 +107,7 @@ /* any intervening fileno() calls could decr this refcnt */ if (!(o = PySequence_Fast_GET_ITEM(fast_seq, i))) - return -1; + goto finally; Py_INCREF(o); v = PyObject_AsFileDescriptor( o ); @@ -438,6 +438,7 @@ if (PyDict_GetItem(self->dict, key) == NULL) { errno = ENOENT; PyErr_SetFromErrno(PyExc_OSError); + Py_DECREF(key); return NULL; } value = PyLong_FromLong(events);