Handle correctly _Py_fopen() error: don't replace the exception
This commit is contained in:
parent
165b1283ff
commit
bd206e27a4
|
@ -736,6 +736,7 @@ read_directory(PyObject *archive_obj)
|
|||
|
||||
fp = _Py_fopen(archive_obj, "rb");
|
||||
if (fp == NULL) {
|
||||
if (!PyErr_Occurred())
|
||||
PyErr_Format(ZipImportError, "can't open Zip file: '%U'", archive_obj);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -909,6 +910,7 @@ get_data(PyObject *archive, PyObject *toc_entry)
|
|||
|
||||
fp = _Py_fopen(archive, "rb");
|
||||
if (!fp) {
|
||||
if (!PyErr_Occurred())
|
||||
PyErr_Format(PyExc_IOError,
|
||||
"zipimport: can not open file %U", archive);
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue