summaryrefslogtreecommitdiffstats
path: root/Modules/zipimport.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 20:05:22 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-12-18 20:05:22 (GMT)
commit357347627186a037805b12ff1740d36d0f8e2e11 (patch)
tree528222a77785f9b82fadcc5ae98cd0d44846fc15 /Modules/zipimport.c
parentbd0850b8575730fb1ea587a64e95c818e9504c13 (diff)
parentbd206e27a49dd4cc94ee264c706614190ce0eb3c (diff)
downloadcpython-357347627186a037805b12ff1740d36d0f8e2e11.zip
cpython-357347627186a037805b12ff1740d36d0f8e2e11.tar.gz
cpython-357347627186a037805b12ff1740d36d0f8e2e11.tar.bz2
(Merge 3.2) Handle correctly _Py_fopen() error: don't replace the exception
Diffstat (limited to 'Modules/zipimport.c')
-rw-r--r--Modules/zipimport.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index ed835c9..09bd83a 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -742,7 +742,8 @@ read_directory(PyObject *archive)
fp = _Py_fopen(archive, "rb");
if (fp == NULL) {
- PyErr_Format(ZipImportError, "can't open Zip file: %R", archive);
+ if (!PyErr_Occurred())
+ PyErr_Format(ZipImportError, "can't open Zip file: %R", archive);
return NULL;
}
fseek(fp, -22, SEEK_END);
@@ -913,8 +914,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;
}