summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-15 02:26:30 (GMT)
committerBrett Cannon <brett@python.org>2013-06-15 02:26:30 (GMT)
commita3c96154d2a8d3dd0023b927a99b485e574c9922 (patch)
treebdbc356425aa360bbbbdc2d816147a8940ef1723 /Lib/imp.py
parent15e489f7c54a3ca5e631b7bfaf26e85daf0547bb (diff)
downloadcpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.zip
cpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.tar.gz
cpython-a3c96154d2a8d3dd0023b927a99b485e574c9922.tar.bz2
Issue #17907: touch up the code for imp.new_module().
Diffstat (limited to 'Lib/imp.py')
-rw-r--r--Lib/imp.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index e06fbe6..7d54e8a 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -17,7 +17,6 @@ except ModuleNotFoundError:
load_dynamic = None
# Directly exposed by this module
-from importlib._bootstrap import new_module
from importlib._bootstrap import cache_from_source, source_from_cache
@@ -28,6 +27,7 @@ import importlib
import os
import sys
import tokenize
+import types
import warnings
@@ -44,6 +44,17 @@ PY_CODERESOURCE = 8
IMP_HOOK = 9
+def new_module(name):
+ """**DEPRECATED**
+
+ Create a new module.
+
+ The module is not entered into sys.modules.
+
+ """
+ return types.ModuleType(name)
+
+
def get_magic():
"""**DEPRECATED**