summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 20:04:17 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 20:04:17 (GMT)
commitbd206e27a49dd4cc94ee264c706614190ce0eb3c (patch)
treeab131b292e8e580077bbfe3bd4661062cc95cb0d /Modules
parent165b1283ffe5922dd9f64ef7edb5534e6983d2f5 (diff)
downloadcpython-bd206e27a49dd4cc94ee264c706614190ce0eb3c.zip
cpython-bd206e27a49dd4cc94ee264c706614190ce0eb3c.tar.gz
cpython-bd206e27a49dd4cc94ee264c706614190ce0eb3c.tar.bz2
Handle correctly _Py_fopen() error: don't replace the exception
Diffstat (limited to 'Modules')
-rw-r--r--Modules/zipimport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 68c2894..11c3904 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -736,7 +736,8 @@ read_directory(PyObject *archive_obj)
fp = _Py_fopen(archive_obj, "rb");
if (fp == NULL) {
- PyErr_Format(ZipImportError, "can't open Zip file: '%U'", archive_obj);
+ if (!PyErr_Occurred())
+ PyErr_Format(ZipImportError, "can't open Zip file: '%U'", archive_obj);
return NULL;
}
fseek(fp, -22, SEEK_END);
@@ -909,8 +910,9 @@ get_data(PyObject *archive, PyObject *toc_entry)
fp = _Py_fopen(archive, "rb");
if (!fp) {
- PyErr_Format(PyExc_IOError,
- "zipimport: can not open file %U", archive);
+ if (!PyErr_Occurred())
+ PyErr_Format(PyExc_IOError,
+ "zipimport: can not open file %U", archive);
return NULL;
}