import.c now catchs _Py_stat() exceptions

_Py_stat() now returns -2 if an exception was raised.
This commit is contained in:
Victor Stinner 2011-12-18 20:47:30 +01:00
parent 7bfe89945b
commit bd0850b857
3 changed files with 37 additions and 13 deletions

View file

@ -102,6 +102,8 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
int rv;
rv = _Py_stat(filename, &statbuf);
if (rv == -2)
goto error;
if (rv == 0) {
/* it exists */
if (!S_ISREG(statbuf.st_mode))
@ -109,8 +111,6 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
Py_CLEAR(filename);
break;
}
else if (PyErr_Occurred())
goto error;
Py_CLEAR(filename);
/* back up one path element */
flen = PyUnicode_FindChar(path, SEP, 0, flen, -1);