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.

Author serhiy.storchaka
Recipients Mariatta, brett.cannon, christian.heimes, ncoghlan, serhiy.storchaka, twouters, vmurashev
Date 2018-08-31.22:32:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535754760.38.0.56676864532.issue18307@psf.upfronthosting.co.za>
In-reply-to
Content
The patch for the Python implementation of zipimport (see issue25711) is much simpler (see the attached sample patch). But it requires adding a way of modifying co_filename. Currently code objects are immutable.

This issue looks as a part of the larger problem. Zipimport is not the only source of precompiled bytecode which needs updating co_filename. For example the tree of py and pyc files can be moved to other place. Also, since co_filename contains system depended path, it doesn't make sense when load pyc files on other system (for example if they were created on Linux and ran on Windows). On other side, the import machinery tries to load pyc and py files, therefore it should know the path of corresponding py file when load a pyc file. Maybe it be better to not save co_filename in a pyc file (note that all code object in a file have the same co_filename, but it is saved for every code object), but set co_filename after unmarshalling the module bytecode by the import machinery in all loaders.
History
Date User Action Args
2018-08-31 22:32:40serhiy.storchakasetrecipients: + serhiy.storchaka, twouters, brett.cannon, ncoghlan, christian.heimes, vmurashev, Mariatta
2018-08-31 22:32:40serhiy.storchakasetmessageid: <1535754760.38.0.56676864532.issue18307@psf.upfronthosting.co.za>
2018-08-31 22:32:40serhiy.storchakalinkissue18307 messages
2018-08-31 22:32:40serhiy.storchakacreate