]> granicus.if.org Git - python/commit
Issue #14582: Import returns the module returned by a loader instead
authorBrett Cannon <brett@python.org>
Sun, 15 Apr 2012 19:24:04 +0000 (15:24 -0400)
committerBrett Cannon <brett@python.org>
Sun, 15 Apr 2012 19:24:04 +0000 (15:24 -0400)
commit881535b726c595582920acc69f26b053e32b85b0
treeca3bcfcff049f02a4dc5e1187b0a9e5d1beb489d
parent27fc52877ce3cabb2ed524ab0f40f8c8e3a45c18
Issue #14582: Import returns the module returned by a loader instead
of sys.modules when possible.

This is being done for two reasons. One is to gain a little bit of
performance by skipping an unnecessary dict lookup in sys.modules. But
the other (and main) reason is to be a little bit more clear in how
things should work from the perspective of import's interactions with
loaders. Otherwise loaders can easily forget to return the module even
though PEP 302 explicitly states they are expected to return the module
they loaded.
Lib/importlib/_bootstrap.py
Lib/importlib/test/import_/test_caching.py
Misc/NEWS
Python/import.c
Python/importlib.h