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 indygreg
Recipients BTaskaya, Mark.Shannon, brandtbucher, brett.cannon, eric.snow, gvanrossum, indygreg, larry, lemburg, methane, miss-islington, nascheme, ncoghlan, rhettinger, ronaldoussoren, shihai1991, terry.reedy, vstinner
Date 2021-09-23.02:27:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I'll throw out that __file__ is strictly optional, per IMO it is more important to define than __file__ (so tracebacks have source context).

Given that __file__ is optional, I'll throw out the idea of shipping modules without __file__/__cached__ and see what issues/pushback occurs. I anticipate this will likely result in having to restore advertising __file__ in frozen modules in 3.11 due to popular demand. But we /could/ use this as an opportunity to start attempting to ween people off __file__ and onto more appropriate APIs, like importlib.resources. (importlib.resources was introduced in 3.7 and I'm not sure that's old enough to force people onto without relying on a shim like

Alternatively, defining a path hook referencing the python executable that knows how to service frozen modules could also work. zipimporter does this (__file__ is <zip_path>/<virtual_module_path>) and it is surprisingly not as brittle as one would think. It might be a good middle ground.
Date User Action Args
2021-09-23 02:27:46indygregsetrecipients: + indygreg, lemburg, gvanrossum, brett.cannon, nascheme, rhettinger, terry.reedy, ronaldoussoren, ncoghlan, vstinner, larry, methane, Mark.Shannon, eric.snow, miss-islington, brandtbucher, BTaskaya, shihai1991
2021-09-23 02:27:46indygregsetmessageid: <>
2021-09-23 02:27:46indygreglinkissue45020 messages
2021-09-23 02:27:45indygregcreate