[New-bugs-announce] [issue23696] zipimport: chain ImportError to OSError

STINNER Victor report at bugs.python.org
Wed Mar 18 01:58:16 CET 2015


New submission from STINNER Victor:

To work on the issue #23694, I refactored the C function _Py_fopen_obj() to raise an exception on error. I noticed the that zipimport replaces the current exception with ZipImportError.

Attached patch chains the ZipImportError to the OSError to provide more context on error. For example, you can see in the unit test that ZipImportError was caused by a permission error.

Is it ok to require ZipImport.__context__ to be an OSError in the unit test? Can it be added to "zipimport spec"? If not, the test may be splitted to only check __context__ in a test decorated with @cpython_only.

----------
files: zipimporterror_oserror.patch
keywords: patch
messages: 238368
nosy: brett.cannon, haypo, ncoghlan
priority: normal
severity: normal
status: open
title: zipimport: chain ImportError to OSError
versions: Python 3.5
Added file: http://bugs.python.org/file38536/zipimporterror_oserror.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23696>
_______________________________________


More information about the New-bugs-announce mailing list