[issue25710] zipimport is not PEP 3147 or PEP 488 compliant

Robert Byrnes report at bugs.python.org
Mon Nov 23 10:44:56 EST 2015


New submission from Robert Byrnes:

zipimport is not PEP 3147 compliant: i.e., it looks for foo.pyc (in the same directory as foo.py) instead of __pycache__/foo.cpython-35.pyc.  This is counterintuitive, and unfortunate because it means that installation directories (that obey PEP 3147 conventions) can't be zip archived from filesystems and then used by zipimport.

When support for PEP 488 was added to Python 3.5, zipimport was modified to just delete references to .pyo files, but it needs to know about the new .opt-[12] filename components (as well as the PEP 3147 version tags).  As far as I can tell, the current version of zipimport can't import optimized bytecode files, using either the old or new filename conventions.

Finally, none of this behavior is documented.  The zipimport docs still mention .pyo files (which were eliminated by PEP 488), and say nothing about the filename conventions expected within zip archives.

----------
components: Extension Modules
messages: 255178
nosy: byrnes
priority: normal
severity: normal
status: open
title: zipimport is not PEP 3147 or PEP 488 compliant
type: behavior
versions: Python 3.6

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


More information about the Python-bugs-list mailing list