summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-06-30 07:33:17 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-06-30 07:33:17 (GMT)
commiteb51faadbe278fbc970c65ba27015b37b7e42c8d (patch)
tree7fa29c28b95a165bc6d291f4a508a27f88361ee0
parent457509826ec0ed9c593c46d122e910f5cae36e58 (diff)
downloadcpython-eb51faadbe278fbc970c65ba27015b37b7e42c8d.zip
cpython-eb51faadbe278fbc970c65ba27015b37b7e42c8d.tar.gz
cpython-eb51faadbe278fbc970c65ba27015b37b7e42c8d.tar.bz2
Issue #27418: Fixed Tools/importbench/importbench.py.
-rw-r--r--Misc/NEWS5
-rw-r--r--Tools/importbench/importbench.py13
2 files changed, 11 insertions, 7 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 2356984..330d170 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -72,6 +72,11 @@ C API
- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
an iterable of integers. Now only strings and bytes-like objects are accepted.
+Tools/Demos
+-----------
+
+- Issue #27418: Fixed Tools/importbench/importbench.py.
+
What's New in Python 3.5.2?
===========================
diff --git a/Tools/importbench/importbench.py b/Tools/importbench/importbench.py
index 635dd56..e2ef758 100644
--- a/Tools/importbench/importbench.py
+++ b/Tools/importbench/importbench.py
@@ -5,7 +5,6 @@ thus has no external changes made to import-related attributes in sys.
"""
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 @@ def source_wo_bytecode(seconds, repeat):
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 @@ def source_writing_bytecode(seconds, repeat):
"""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 @@ decimal_writing_bytecode = _writing_bytecode(decimal)
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]))