diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-09-04 22:34:09 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-09-04 22:34:09 (GMT) |
commit | 1b933ed50aef2c31e003a001cef8647244ebfa0e (patch) | |
tree | 1d434753b2e2fd9e1454f4bd614c73a90bab903f /Python/import.c | |
parent | 1d6a16bf3838bfb89efdd5e338b247324d962010 (diff) | |
download | cpython-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/import.c')
-rw-r--r-- | Python/import.c | 2 |
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(); } |