[Python-checkins] cpython (merge 3.5 -> default): Issue #27418: Fixed Tools/importbench/importbench.py.

serhiy.storchaka python-checkins at python.org
Thu Jun 30 03:35:08 EDT 2016


https://hg.python.org/cpython/rev/c2e898813409
changeset:   102228:c2e898813409
parent:      102226:4ea79767ff75
parent:      102227:ba4548916f05
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Jun 30 10:34:52 2016 +0300
summary:
  Issue #27418: Fixed Tools/importbench/importbench.py.

files:
  Misc/NEWS                        |   5 +++++
  Tools/importbench/importbench.py |  13 ++++++-------
  2 files changed, 11 insertions(+), 7 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -125,6 +125,11 @@
 
 - Don't use largefile support for GNU/Hurd.
 
+Tools/Demos
+-----------
+
+- Issue #27418: Fixed Tools/importbench/importbench.py.
+
 
 What's New in Python 3.6.0 alpha 2
 ==================================
diff --git a/Tools/importbench/importbench.py b/Tools/importbench/importbench.py
--- a/Tools/importbench/importbench.py
+++ b/Tools/importbench/importbench.py
@@ -5,7 +5,6 @@
 
 """
 from test.test_importlib import util
-from test.test_importlib.source import util as source_util
 import decimal
 import imp
 import importlib
@@ -65,11 +64,11 @@
     try:
         name = '__importlib_test_benchmark__'
         # Clears out sys.modules and puts an entry at the front of sys.path.
-        with source_util.create_modules(name) as mapping:
+        with util.create_modules(name) as mapping:
             assert not os.path.exists(imp.cache_from_source(mapping[name]))
             sys.meta_path.append(importlib.machinery.PathFinder)
             loader = (importlib.machinery.SourceFileLoader,
-                      importlib.machinery.SOURCE_SUFFIXES, True)
+                      importlib.machinery.SOURCE_SUFFIXES)
             sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
             yield from bench(name, lambda: sys.modules.pop(name), repeat=repeat,
                              seconds=seconds)
@@ -102,10 +101,10 @@
     """Source writing bytecode: small"""
     assert not sys.dont_write_bytecode
     name = '__importlib_test_benchmark__'
-    with source_util.create_modules(name) as mapping:
+    with util.create_modules(name) as mapping:
         sys.meta_path.append(importlib.machinery.PathFinder)
         loader = (importlib.machinery.SourceFileLoader,
-                  importlib.machinery.SOURCE_SUFFIXES, True)
+                  importlib.machinery.SOURCE_SUFFIXES)
         sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
         def cleanup():
             sys.modules.pop(name)
@@ -136,10 +135,10 @@
 def source_using_bytecode(seconds, repeat):
     """Source w/ bytecode: small"""
     name = '__importlib_test_benchmark__'
-    with source_util.create_modules(name) as mapping:
+    with util.create_modules(name) as mapping:
         sys.meta_path.append(importlib.machinery.PathFinder)
         loader = (importlib.machinery.SourceFileLoader,
-                importlib.machinery.SOURCE_SUFFIXES, True)
+                  importlib.machinery.SOURCE_SUFFIXES)
         sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
         py_compile.compile(mapping[name])
         assert os.path.exists(imp.cache_from_source(mapping[name]))

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


More information about the Python-checkins mailing list