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 gvanrossum
Recipients barry, eric.snow, gvanrossum, lemburg, ncoghlan
Date 2021-09-15.21:07:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631740032.97.0.128416650848.issue21736@roundup.psfhosted.org>
In-reply-to
Content
> Note that the filename information is already available in the
> code object's co_filename attribute.

Hm, in the latest (3.11) main that's not true -- co_filename is set to something like "<frozen ntpath>". And that's about right, since the filename contained in the frozen data can at best reflect the filename at the time the freeze script ran, which is not necessarily the same as the filename when the user runs the Python binary.

I don't think we should try to set __file__ or any other attributes on frozen modules (at least not for the small set of frozen modules we're contemplating for 3.11).  User who need the file can run their Python 3.11 binary with -Xfrozen_modules=off, to disable the use of frozen modules (other than the three importlib bootstrap files).

Tools that freeze the entire stdlib or 3rd party code may have to make a  different choice, but that's not our problem (yet).
History
Date User Action Args
2021-09-15 21:07:13gvanrossumsetrecipients: + gvanrossum, lemburg, barry, ncoghlan, eric.snow
2021-09-15 21:07:12gvanrossumsetmessageid: <1631740032.97.0.128416650848.issue21736@roundup.psfhosted.org>
2021-09-15 21:07:12gvanrossumlinkissue21736 messages
2021-09-15 21:07:12gvanrossumcreate