Message402476
| 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 | <1632364066.22.0.546669885041.issue45020@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
I'll throw out that __file__ is strictly optional, per https://docs.python.org/3/reference/datamodel.html. IMO it is more important to define importlib.abc.InspectLoader 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 https://pypi.org/project/importlib-resources/.) 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. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2021-09-23 02:27:46 | indygreg | set | recipients: + 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:46 | indygreg | set | messageid: <1632364066.22.0.546669885041.issue45020@roundup.psfhosted.org> |
| 2021-09-23 02:27:46 | indygreg | link | issue45020 messages |
| 2021-09-23 02:27:45 | indygreg | create | |