summaryrefslogtreecommitdiffstats
path: root/Lib/imp.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-07-09 20:09:00 (GMT)
committerBrett Cannon <brett@python.org>2012-07-09 20:09:00 (GMT)
commit77b2abd094998b89ff4d806b78683d4cce8d6d79 (patch)
tree7d710186109f3c551675e3d2e374589e8741d33c /Lib/imp.py
parentafbb5fbeb82a1943a10e6709e8199dc984819ddf (diff)
downloadcpython-77b2abd094998b89ff4d806b78683d4cce8d6d79.zip
cpython-77b2abd094998b89ff4d806b78683d4cce8d6d79.tar.gz
cpython-77b2abd094998b89ff4d806b78683d4cce8d6d79.tar.bz2
Issue #15167 (as part of #13959): imp.get_magic() is no implemented in
Lib/imp.py.
Diffstat (limited to 'Lib/imp.py')
-rw-r--r--Lib/imp.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/imp.py b/Lib/imp.py
index dab8312..58d1c97 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -10,12 +10,12 @@ from _imp import (lock_held, acquire_lock, release_lock,
load_dynamic, get_frozen_object, is_frozen_package,
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
+# Directly exposed by this module
from importlib._bootstrap import new_module
from importlib._bootstrap import cache_from_source
+
from importlib import _bootstrap
from importlib import machinery
import os
@@ -37,6 +37,11 @@ PY_CODERESOURCE = 8
IMP_HOOK = 9
+def get_magic():
+ """Return the magic number for .pyc or .pyo files."""
+ return _bootstrap._MAGIC_BYTES
+
+
def get_tag():
"""Return the magic tag for .pyc or .pyo files."""
return sys.implementation.cache_tag