summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorNina Zakharenko <nzakharenko@gmail.com>2019-02-05 00:56:26 (GMT)
committerBarry Warsaw <barry@python.org>2019-02-05 00:56:26 (GMT)
commit69091cb497b2f0fe7e2789b30b43cf78caf9de9b (patch)
tree60e8125f1d1a74a77ffef29d97eed71e8de13383 /Lib/importlib
parent89427cd0feae25bbc8693abdccfa6a8c81a2689c (diff)
downloadcpython-69091cb497b2f0fe7e2789b30b43cf78caf9de9b.zip
cpython-69091cb497b2f0fe7e2789b30b43cf78caf9de9b.tar.gz
cpython-69091cb497b2f0fe7e2789b30b43cf78caf9de9b.tar.bz2
bpo-35321: Set the spec origin to frozen in frozen modules (#11732)
* bpo-35321: Set the spec origin to frozen in frozen modules This fix correctly sets the spec origin to "frozen" for the _frozen_importlib module. Note that the origin was already correctly set in _frozen_importlib_external. * 📜🤖 Added by blurb_it.
Diffstat (limited to 'Lib/importlib')
-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 857583a..70b706a 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -786,6 +786,8 @@ class FrozenImporter:
"""
+ _ORIGIN = "frozen"
+
@staticmethod
def module_repr(m):
"""Return repr for the module.
@@ -793,12 +795,12 @@ class FrozenImporter:
The method is deprecated. The import machinery does the job itself.
"""
- return '<module {!r} (frozen)>'.format(m.__name__)
+ return '<module {!r} ({})>'.format(m.__name__, FrozenImporter._ORIGIN)
@classmethod
def find_spec(cls, fullname, path=None, target=None):
if _imp.is_frozen(fullname):
- return spec_from_loader(fullname, cls, origin='frozen')
+ return spec_from_loader(fullname, cls, origin=cls._ORIGIN)
else:
return None