cpython: 005fd1fe31ab (original) (raw)

--- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -974,12 +974,12 @@ def find_and_load(name, import): loader = _find_module(name, path) if loader is None: raise ImportError(_ERR_MSG.format(name), name=name)

@@ -1078,7 +1078,11 @@ def import(name, globals={}, locals= # Return up to the first dot in 'name'. This is complicated by the fact # that 'name' may be relative. if level == 0:

--- a/Lib/importlib/test/import_/test_caching.py +++ b/Lib/importlib/test/import_/test_caching.py @@ -47,36 +47,12 @@ class UseCache(unittest.TestCase): mock.load_module = MethodType(load_module, mock) return mock

-

-

def test_main():

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.3.0 Alpha 3? Core and Builtins ----------------- +- Issue #14582: Import directly returns the module as returned by a loader when

--- a/Python/import.c +++ b/Python/import.c @@ -3019,15 +3019,22 @@ PyImport_ImportModuleLevelObject(PyObjec Py_DECREF(partition); if (level == 0) {

--- a/Python/importlib.h +++ b/Python/importlib.h @@ -2606,7 +2606,7 @@ unsigned char _Py_M__importlib[] = { 115,97,110,105,116,121,95,99,104,101,99,107,117,20,0,0, 0,78,111,32,109,111,100,117,108,101,32,110,97,109,101,100, 32,123,33,114,125,99,2,0,0,0,0,0,0,0,8,0,

};