[Python-checkins] cpython: Don't worry about moving imp.get_tag() over to Lib/imp.py.

brett.cannon python-checkins at python.org
Sun Apr 22 00:56:02 CEST 2012


http://hg.python.org/cpython/rev/024660a2faaa
changeset:   76453:024660a2faaa
user:        Brett Cannon <brett at python.org>
date:        Sat Apr 21 18:55:51 2012 -0400
summary:
  Don't worry about moving imp.get_tag() over to Lib/imp.py.

files:
  Lib/imp.py                  |    4 ++--
  Lib/importlib/_bootstrap.py |    4 +++-
  Python/importlib.h          |  Bin 
  3 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Lib/imp.py b/Lib/imp.py
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -11,9 +11,9 @@
                   init_builtin, init_frozen, is_builtin, is_frozen,
                   _fix_co_filename)
 # Could move out of _imp, but not worth the code
-from _imp import get_magic
+from _imp import get_magic, get_tag
 # Can (probably) move to importlib
-from _imp import (get_tag, get_suffixes)
+from _imp import get_suffixes
 # Should be re-implemented here (and mostly deprecated)
 from _imp import (find_module, NullImporter,
                   SEARCH_ERROR, PY_SOURCE, PY_COMPILED, C_EXTENSION,
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -201,7 +201,7 @@
     suffix = DEBUG_BYTECODE_SUFFIX if debug else OPT_BYTECODE_SUFFIX
     head, tail = _path_split(path)
     base_filename, sep, _ = tail.partition('.')
-    filename = ''.join([base_filename, sep, _imp.get_tag(), suffix])
+    filename = ''.join([base_filename, sep, _TAG, suffix])
     return _path_join(head, PYCACHE, filename)
 
 
@@ -1148,6 +1148,7 @@
 
 
 _MAGIC_NUMBER = None  # Set in _setup()
+_TAG = None  # Set in _setup()
 
 
 def _setup(sys_module, _imp_module):
@@ -1197,6 +1198,7 @@
     # 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())
     if builtin_os == 'nt':
         SOURCE_SUFFIXES.append('.pyw')
 
diff --git a/Python/importlib.h b/Python/importlib.h
index c369e3c3d370995a3f8e808c1705ffe9037db96c..c48b5507699c679b7353d7e96ca9f4965da97c5b
GIT binary patch
[stripped]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list