Gregory Szorc <gregory.sz...@gmail.com> added the comment:

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

----------

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

Reply via email to