Issue #23696: Chain ZipImportError to the OSError

This commit is contained in:
Victor Stinner 2015-03-20 10:52:25 +01:00
parent 99953006df
commit fbd6f9ed12
2 changed files with 9 additions and 2 deletions

View file

@ -875,8 +875,12 @@ read_directory(PyObject *archive)
fp = _Py_fopen_obj(archive, "rb");
if (fp == NULL) {
if (PyErr_ExceptionMatches(PyExc_OSError))
if (PyErr_ExceptionMatches(PyExc_OSError)) {
PyObject *exc, *val, *tb;
PyErr_Fetch(&exc, &val, &tb);
PyErr_Format(ZipImportError, "can't open Zip file: %R", archive);
_PyErr_ChainExceptions(exc, val, tb);
}
return NULL;
}