zipimport: catch _PyUnicode_AsString() failure in get_code_from_data()

It occurs if the path contains surrogates.
This commit is contained in:
Victor Stinner 2010-10-16 11:29:07 +00:00
parent 2c2bfe5bdf
commit 5a7913eb3b

View file

@ -1119,6 +1119,10 @@ get_code_from_data(ZipImporter *self, int ispackage, int isbytecode,
return NULL;
modpath = _PyUnicode_AsString(PyTuple_GetItem(toc_entry, 0));
if (modpath == NULL) {
Py_DECREF(data);
return NULL;
}
if (isbytecode) {
code = unmarshal_code(modpath, data, mtime);