diff options
author | Brett Cannon <brett@python.org> | 2012-07-09 20:09:00 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-07-09 20:09:00 (GMT) |
commit | 77b2abd094998b89ff4d806b78683d4cce8d6d79 (patch) | |
tree | 7d710186109f3c551675e3d2e374589e8741d33c /Lib/imp.py | |
parent | afbb5fbeb82a1943a10e6709e8199dc984819ddf (diff) | |
download | cpython-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.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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 |