summaryrefslogtreecommitdiffstats
path: root/Modules/zipimport.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/zipimport.c')
-rw-r--r--Modules/zipimport.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index e83214c..38dc0c4 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -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;
}