summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-04 22:34:09 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2008-09-04 22:34:09 (GMT)
commit1b933ed50aef2c31e003a001cef8647244ebfa0e (patch)
tree1d434753b2e2fd9e1454f4bd614c73a90bab903f /Python
parent1d6a16bf3838bfb89efdd5e338b247324d962010 (diff)
downloadcpython-1b933ed50aef2c31e003a001cef8647244ebfa0e.zip
cpython-1b933ed50aef2c31e003a001cef8647244ebfa0e.tar.gz
cpython-1b933ed50aef2c31e003a001cef8647244ebfa0e.tar.bz2
#3773: Check for errors around the use of PyTokenizer_FindEncoding().
reviewed by Brett Cannon.
Diffstat (limited to 'Python')
-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();
}