diff options
author | Brett Cannon <brett@python.org> | 2013-06-15 02:26:30 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-06-15 02:26:30 (GMT) |
commit | a3c96154d2a8d3dd0023b927a99b485e574c9922 (patch) | |
tree | bdbc356425aa360bbbbdc2d816147a8940ef1723 /Lib/importlib | |
parent | 15e489f7c54a3ca5e631b7bfaf26e85daf0547bb (diff) | |
download | cpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.zip cpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.tar.gz cpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.tar.bz2 |
Issue #17907: touch up the code for imp.new_module().
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 11 | ||||
-rw-r--r-- | Lib/importlib/util.py | 2 |
2 files changed, 3 insertions, 10 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index 4558054..1276ff1 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -121,15 +121,6 @@ def _wrap(new, old): _code_type = type(_wrap.__code__) -def new_module(name): - """Create a new module. - - The module is not entered into sys.modules. - - """ - return type(_io)(name) - - # Module-level locking ######################################################## # A dict mapping module names to weakrefs of _ModuleLock instances @@ -509,7 +500,7 @@ class _ModuleManager: # This must be done before open() is called as the 'io' module # implicitly imports 'locale' and would otherwise trigger an # infinite loop. - self._module = new_module(self._name) + self._module = type(_io)(self._name) # This must be done before putting the module in sys.modules # (otherwise an optimization shortcut in import.c becomes wrong) self._module.__initializing__ = True diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py index 09ec03c..06f4d2f 100644 --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -1,9 +1,11 @@ """Utility code for constructing importers, etc.""" from ._bootstrap import MAGIC_NUMBER +from ._bootstrap import cache_from_source from ._bootstrap import module_to_load from ._bootstrap import set_loader from ._bootstrap import set_package +from ._bootstrap import source_from_cache from ._bootstrap import _resolve_name import functools |