summaryrefslogtreecommitdiff
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index e17eeb6585..8de0e9ee79 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -713,6 +713,8 @@ class BuiltinImporter:
"""
+ _ORIGIN = "built-in"
+
@staticmethod
def module_repr(module):
"""Return repr for the module.
@@ -720,14 +722,14 @@ class BuiltinImporter:
The method is deprecated. The import machinery does the job itself.
"""
- return '<module {!r} (built-in)>'.format(module.__name__)
+ return f'<module {module.__name__!r} ({BuiltinImporter._ORIGIN})>'
@classmethod
def find_spec(cls, fullname, path=None, target=None):
if path is not None:
return None
if _imp.is_builtin(fullname):
- return spec_from_loader(fullname, cls, origin='built-in')
+ return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
else:
return None