[Python-Dev] importlib is now bootstrapped (and what that means) (original) (raw)

Stefan Behnel stefan_ml at behnel.de
Mon Apr 16 09:54:41 CEST 2012


Brett Cannon, 14.04.2012 20:12:

My multi-year project -- started in 2006 according to my blog -- to rewrite import in pure Python and then bootstrap it into CPython as the implementation of import() is finally over (mostly)! Hopefully I didn't break too much code in the process. =)

Well, some at least.

The new import cache broke Cython's load of on-the-fly compiled extension modules, which naively used "import(module_name)" after building them. I could fix that by moving to "imp.load_dynamic()" (we know where we put the compiled module anyway), although I just noticed that that's not actually documented. So I hope that won't break later on.

The next thing I noticed is that the old-style level -1 import no longer works, which presumably breaks a lot of Cython compiled modules. It used to work in the master branch until two days ago, now it raises a ValueError. We may be able to fix this by copying over CPython's old import code into Cython, but I actually wonder if this was really intended. If this feature wasn't deliberately broken in Py3.0, why break it now?

Stefan



More information about the Python-Dev mailing list