mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
import.c now catchs _Py_stat() exceptions
_Py_stat() now returns -2 if an exception was raised.
This commit is contained in:
parent
7bfe89945b
commit
bd0850b857
3 changed files with 37 additions and 13 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue