[issue17636] Modify IMPORT_FROM to fallback on sys.modules

Brett Cannon report at bugs.python.org
Wed Jun 5 18:45:20 CEST 2013


Brett Cannon added the comment:

If you look at the importlib source code in 2.7 it's actually really small and simply translates the call into an __import__ call under the hood. So __import__ can completely handle relative imports, but you were not using the level argument to __import__ nor passing the necessary globals to make the relative name computation work (see the importlib source if you want to see how it works).

----------

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


More information about the Python-bugs-list mailing list