[issue14657] Avoid two importlib copies

Nick Coghlan report at bugs.python.org
Wed Apr 25 17:38:46 CEST 2012


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Yes, in that you'll be able to pick up changes in _bootstrap.py *without* having to rebuild Python.

With this in place, we could then get rid of the automatic regeneration of importlib.h which is a complete nightmare if you ever break your built interpreter while hacking on the bootstrapping (as I now know from experience).

With my approach, the experience is instead:

- modify _bootstrap.py, hack until any new tests pass
- run a new explicit "make freeze_importlib" command
- run "make"
- check everything still works
- commit and push

If you forget to run "make freeze_importlib", it doesn't really matter all that much, since the frozen one will only be used to find the real one, so it isn't a disaster if it's a little out of date. (That said, we should still have a test that at least checks the two modules have the same attributes)

It does mean that importlib.__init__ also needs to be able to run in a partially initialised interpreter, hence the switch from "import imp" to "import _imp".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14657>
_______________________________________


More information about the Python-bugs-list mailing list