[issue14657] Avoid two importlib copies
Nick Coghlan
report at bugs.python.org
Wed Apr 25 17:14:59 CEST 2012
Nick Coghlan <ncoghlan at gmail.com> added the comment:
OK, I'm leaning back towards my original preference of getting _frozen_importlib out of the way as quickly as we can.
Specifically, I'm thinking of separating out the entry point used by importlib.__init__ from that used by pythonrun.c, such that the latter calls a "_bootstrap_from_frozen" function that returns a reference to "importlib._bootstrap", which pythonrun then places in the interpreter state.
There would be a few builtin modules that still end up with loaders from _frozen_importlib (specifically, those referenced from importlib._bootstrap._setup as well as importlib itself), but the vast majority of imported modules would only see the "real" versions from importlib._bootstrap.
Attached patch is an initial attempt (the reference counting on the two modules is likely still a bit dodgy - this is my first version that didn't segfault as I got used to the mechanics of dealing with a frozen module, so it errs on the side of leaking references)
----------
Added file: http://bugs.python.org/file25364/issue14657_bootstrap_from_disk.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14657>
_______________________________________
More information about the Python-bugs-list
mailing list