diff options
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c index e5581c5..f443ab8 100644 --- a/Python/import.c +++ b/Python/import.c @@ -3195,8 +3195,10 @@ call_find_module(char *name, PyObject *path) memory. */ found_encoding = PyTokenizer_FindEncoding(fd); lseek(fd, 0, 0); /* Reset position */ - if (found_encoding == NULL && PyErr_Occurred()) + if (found_encoding == NULL && PyErr_Occurred()) { + close(fd); return NULL; + } encoding = (found_encoding != NULL) ? found_encoding : (char*)PyUnicode_GetDefaultEncoding(); } |