commit | 1b933ed50aef2c31e003a001cef8647244ebfa0e | [log] [tgz] |
---|---|---|
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | Thu Sep 04 22:34:09 2008 +0000 |
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | Thu Sep 04 22:34:09 2008 +0000 |
tree | 1d434753b2e2fd9e1454f4bd614c73a90bab903f | |
parent | 1d6a16bf3838bfb89efdd5e338b247324d962010 [diff] [blame] |
#3773: Check for errors around the use of PyTokenizer_FindEncoding(). reviewed by Brett Cannon.
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 @@ 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(); }