Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions 6 Lib/importlib/_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,21 +713,23 @@ class BuiltinImporter:

"""

_ORIGIN = "built-in"

@staticmethod
def module_repr(module):
"""Return repr for the module.

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

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Update :class:`importlib.machinery.BuiltinImporter` to use ``loader._ORIGIN``
instead of a hardcoded value. Patch by Dong-hee Na.
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.