summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/abc.py')
-rw-r--r--Lib/importlib/abc.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/importlib/abc.py b/Lib/importlib/abc.py
index 7752ac4..cdcf244 100644
--- a/Lib/importlib/abc.py
+++ b/Lib/importlib/abc.py
@@ -165,6 +165,13 @@ class InspectLoader(Loader):
"""
raise ImportError
+ def source_to_code(self, data, path='<string>'):
+ """Compile 'data' into a code object.
+
+ The 'data' argument can be anything that compile() can handle. The'path'
+ argument should be where the data was retrieved (when applicable)."""
+ return compile(data, path, 'exec', dont_inherit=True)
+
_register(InspectLoader, machinery.BuiltinImporter, machinery.FrozenImporter,
machinery.ExtensionFileLoader)