This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyZipFile mixes compiled files from different python versions.
Type: behavior Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Amund Hov, r.david.murray
Priority: normal Keywords:

Created on 2015-08-05 09:43 by Amund Hov, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg248024 - (view) Author: Amund Hov (Amund Hov) Date: 2015-08-05 09:43
In my project I have a mixture of scripts using Python 2.7 and 3.4.
Some of the scripts using python 3.4 are packaged into archives using
PyZipFile.

Through some combination I ended up with 2.7 compiled packages in my archive when packaging using python 3.4. In combination with issue 24792 "zipimporter masks import errors" this led to many grey hairs figuring out why my packaging scripts suddenly broke.

Are there sufficient provisions in PyZipFile to prevent this? It seems it will happily mix compiled files with differing magic bytes.
msg248041 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-08-05 14:02
Yes, that used to be a general problem with .pyc files before we introduced __pycache__.  PyZipFile still supports the "legacy mode" by using whatever .pyc file is there, if there is one.  Perhaps it is time to deprecate the legacy mode in 3.6?
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68982
2015-08-05 14:47:19r.david.murraysetnosy: + r.david.murray
messages: + msg248041
2015-08-05 09:43:32Amund Hovcreate