summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 7f62ab1..88130a1 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -499,9 +499,11 @@ select_poll_modify_impl(pollObject *self, int fd, unsigned short eventmask)
key = PyLong_FromLong(fd);
if (key == NULL)
return NULL;
- if (PyDict_GetItem(self->dict, key) == NULL) {
- errno = ENOENT;
- PyErr_SetFromErrno(PyExc_OSError);
+ if (PyDict_GetItemWithError(self->dict, key) == NULL) {
+ if (!PyErr_Occurred()) {
+ errno = ENOENT;
+ PyErr_SetFromErrno(PyExc_OSError);
+ }
Py_DECREF(key);
return NULL;
}