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, nascheme, ronaldoussoren
Date 2021-08-30.19:06:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630350415.27.0.579190641812.issue45020@roundup.psfhosted.org>
In-reply-to
Content
> For stdlib modules it wouldn't be a big problem to set __file__ on
> frozen modules.
> Would that be enough to solve the problem?

What do you set __file__ to? Do you still materialize the .py[c] files on disk and set to that? (This would make the most sense.) If you support setting __file__ on a frozen module, how does this work at the C level? A stdlib module would want a different __file__ from a 3rd party module using the frozen module API. This would seemingly require enhancements to the frozen modules C API or some kind of hackery only available to stdlib frozen modules.

>> When I investigated freezing the standard library for PyOxidizer, I ran into a rash
>> of problems. The frozen importer doesn't behave like PathFinder. It doesn't
>> (didn't?) set some common module-level attributes
> This is mostly fixable for stdlib modules.  Which attributes would
> need to be added?  Are there other missing behaviors?

It was a few years ago and I can't recall specifics. I just remember that after encountering a couple unrelated limitations with the frozen importer I decided it was far too primitive to work as a general importer and decided I'd have to roll my own.

> Good point.  Supporting more of the FileLoader API on the frozen
> loader is something to look into, at least for stdlib modules.

>> I agree that we should shore up the frozen importer -- probably in a separate PR though.
>> (@Eric: do you think this is worth its own bpo issue?)
> Yeah.

I have some observations about the implications of this. I typed up a long comment but then realized someone would probably complain about me distracting from the technical parts of this issue. Which forum is most appropriate for this less technical commentary? (I want to lay out the case for building out an official importer far more advanced than frozen importer.)
History
Date User Action Args
2021-08-30 19:06:55indygregsetrecipients: + indygreg, lemburg, gvanrossum, brett.cannon, nascheme, ronaldoussoren, larry, methane, Mark.Shannon, eric.snow, brandtbucher, BTaskaya
2021-08-30 19:06:55indygregsetmessageid: <1630350415.27.0.579190641812.issue45020@roundup.psfhosted.org>
2021-08-30 19:06:55indygreglinkissue45020 messages
2021-08-30 19:06:55indygregcreate