diff options
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/abc.py | 7 |
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) |