[Python-checkins] cpython: Issue #17177: update checkpyc to stop using imp

brett.cannon python-checkins at python.org
Sun Jun 16 00:10:26 CEST 2013


http://hg.python.org/cpython/rev/ca3bdac1f88a
changeset:   84158:ca3bdac1f88a
user:        Brett Cannon <brett at python.org>
date:        Sat Jun 15 18:10:18 2013 -0400
summary:
  Issue #17177: update checkpyc to stop using imp

files:
  Tools/scripts/checkpyc.py |  8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/Tools/scripts/checkpyc.py b/Tools/scripts/checkpyc.py
--- a/Tools/scripts/checkpyc.py
+++ b/Tools/scripts/checkpyc.py
@@ -5,11 +5,11 @@
 import sys
 import os
 from stat import ST_MTIME
-import imp
+import importlib.util
 
 # PEP 3147 compatibility (PYC Repository Directories)
-cache_from_source = (imp.cache_from_source if hasattr(imp, 'get_tag') else
-                     lambda path: path + 'c')
+cache_from_source = (importlib.util.cache_from_source if sys.implementation.cache_tag
+                     else lambda path: path + 'c')
 
 
 def main():
@@ -18,7 +18,7 @@
         silent = (sys.argv[1] == '-s')
     else:
         verbose = silent = False
-    MAGIC = imp.get_magic()
+    MAGIC = importlib.util.MAGIC_NUMBER
     if not silent:
         print('Using MAGIC word', repr(MAGIC))
     for dirname in sys.path:

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


More information about the Python-checkins mailing list