Issue #17907: touch up the code for imp.new_module().
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 @@
_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 @@
# 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