[Python-checkins] cpython (3.2): Handle correctly _Py_fopen() error: don't replace the exception
victor.stinner
python-checkins at python.org
Sun Dec 18 21:04:17 CET 2011
http://hg.python.org/cpython/rev/586bcc05f88f
changeset: 74059:586bcc05f88f
branch: 3.2
parent: 74056:e37c71698409
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Sun Dec 18 21:04:17 2011 +0100
summary:
Handle correctly _Py_fopen() error: don't replace the exception
files:
Modules/zipimport.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -736,7 +736,8 @@
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 @@
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;
}
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list