Guido van Rossum <gu...@python.org> added the comment:

> 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).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue21736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to