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 <rep...@bugs.python.org>
<http://bugs.python.org/issue23696>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to