From: Victor Stinner Date: Mon, 20 Jun 2011 13:16:55 +0000 (+0200) Subject: call_find_module() handles dup() failure: raise an OSError exception X-Git-Tag: v3.3.0a1~2080^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d417d01ec80d9d13918fc90fd3ce0080232a8e7c;p=python call_find_module() handles dup() failure: raise an OSError exception --- diff --git a/Python/import.c b/Python/import.c index de5dc0ca41..19e975a593 100644 --- a/Python/import.c +++ b/Python/import.c @@ -3567,6 +3567,10 @@ call_find_module(PyObject *name, PyObject *path_list) if (fd != -1) fd = dup(fd); fclose(fp); + if (fd == -1) { + PyErr_SetFromErrno(PyExc_OSError); + return NULL; + } fp = NULL; } if (fd != -1) {