summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index d87d751..9c077fe 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2830,6 +2830,8 @@ 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())
+ return NULL;
encoding = (found_encoding != NULL) ? found_encoding :
(char*)PyUnicode_GetDefaultEncoding();
}