summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/imp.py7
-rw-r--r--Lib/importlib/_bootstrap.py2
2 files changed, 7 insertions, 2 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index 8c89237..fcfd3d3 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -11,7 +11,7 @@ from _imp import (lock_held, acquire_lock, release_lock,
init_builtin, init_frozen, is_builtin, is_frozen,
_fix_co_filename, extension_suffixes)
# Could move out of _imp, but not worth the code
-from _imp import get_magic, get_tag
+from _imp import get_magic
from importlib._bootstrap import new_module
from importlib._bootstrap import cache_from_source
@@ -37,6 +37,11 @@ PY_CODERESOURCE = 8
IMP_HOOK = 9
+def get_tag():
+ """Return the magic tag for .pyc or .pyo files."""
+ return sys.implementation.cache_tag
+
+
def get_suffixes():
warnings.warn('imp.get_suffixes() is deprecated; use the constants '
'defined on importlib.machinery instead',
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 36c0e88..21af7ac 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1452,7 +1452,7 @@ def _setup(sys_module, _imp_module):
# Constants
setattr(self_module, '_relax_case', _make_relax_case())
setattr(self_module, '_MAGIC_NUMBER', _imp_module.get_magic())
- setattr(self_module, '_TAG', _imp.get_tag())
+ setattr(self_module, '_TAG', sys.implementation.cache_tag)
if builtin_os == 'nt':
SOURCE_SUFFIXES.append('.pyw')