[issue10955] Possible regression with stdlib in zipfile

STINNER Victor report at bugs.python.org
Thu Jan 20 15:30:07 CET 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

zipimport decodes filenames of the archive from cp437 or UTF-8 (depending on a flag in each file entry). Python has a builtin UTF-8 codec, but no cp437 builtin codec. You should try to add encodings/cp437.py to your python3.2/ directory, or to build a ZIP archive with unicode filenames (I don't know how to do that).

Call trace:
 - Load the codec of the filesystem encoding
 - Initialize the codec registry
 - Load the codec from python32.zip
 - Load cp437 or UTF-8 codec to decode python32.zip filenames
 - *Bootstrap failure*

Detailed call trace to initialize the codec registry:
 - import encodings (Lib/encodings/__init__.py)
 - import codecs (Load Lib/codecs.py)
 - import encodings.aliases (Load Lib/encodings/aliases.py)

And then the call trace to load UTF-8 codec:
 - import encodings.utf_8 (Lib/encodings/utf_8.py)

Later, initstdio() loads also Latin1 codec (import encodings.latin_1, Lib/encodings/latin_1.py).

Python has builtin codecs for MBCS (filesystem encoding on Windows) and UTF-8 (filesystem encodings on Mac OS X and many other OSes) encodings, but the codec lookup loads the encodings module (encodings/xxx.py).

----------

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


More information about the Python-bugs-list mailing list