#3773: Check for errors around the use of PyTokenizer_FindEncoding().

reviewed by Brett Cannon.
This commit is contained in:
Amaury Forgeot d'Arc 2008-09-04 22:34:09 +00:00
parent 1d6a16bf38
commit 1b933ed50a
3 changed files with 9 additions and 1 deletions

View file

@ -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();
}