Skip to content

Commit 0e7a95a

Browse files
Issue #27418: Fixed Tools/importbench/importbench.py.
1 parent 48cfef9 commit 0e7a95a

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Misc/NEWS

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ C API
7272
- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as
7373
an iterable of integers. Now only strings and bytes-like objects are accepted.
7474

75+
Tools/Demos
76+
-----------
77+
78+
- Issue #27418: Fixed Tools/importbench/importbench.py.
79+
7580

7681
What's New in Python 3.5.2?
7782
===========================

Tools/importbench/importbench.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
66
"""
77
from test.test_importlib import util
8-
from test.test_importlib.source import util as source_util
98
import decimal
109
import imp
1110
import importlib
@@ -65,11 +64,11 @@ def source_wo_bytecode(seconds, repeat):
6564
try:
6665
name = '__importlib_test_benchmark__'
6766
# Clears out sys.modules and puts an entry at the front of sys.path.
68-
with source_util.create_modules(name) as mapping:
67+
with util.create_modules(name) as mapping:
6968
assert not os.path.exists(imp.cache_from_source(mapping[name]))
7069
sys.meta_path.append(importlib.machinery.PathFinder)
7170
loader = (importlib.machinery.SourceFileLoader,
72-
importlib.machinery.SOURCE_SUFFIXES, True)
71+
importlib.machinery.SOURCE_SUFFIXES)
7372
sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
7473
yield from bench(name, lambda: sys.modules.pop(name), repeat=repeat,
7574
seconds=seconds)
@@ -102,10 +101,10 @@ def source_writing_bytecode(seconds, repeat):
102101
"""Source writing bytecode: small"""
103102
assert not sys.dont_write_bytecode
104103
name = '__importlib_test_benchmark__'
105-
with source_util.create_modules(name) as mapping:
104+
with util.create_modules(name) as mapping:
106105
sys.meta_path.append(importlib.machinery.PathFinder)
107106
loader = (importlib.machinery.SourceFileLoader,
108-
importlib.machinery.SOURCE_SUFFIXES, True)
107+
importlib.machinery.SOURCE_SUFFIXES)
109108
sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
110109
def cleanup():
111110
sys.modules.pop(name)
@@ -136,10 +135,10 @@ def cleanup():
136135
def source_using_bytecode(seconds, repeat):
137136
"""Source w/ bytecode: small"""
138137
name = '__importlib_test_benchmark__'
139-
with source_util.create_modules(name) as mapping:
138+
with util.create_modules(name) as mapping:
140139
sys.meta_path.append(importlib.machinery.PathFinder)
141140
loader = (importlib.machinery.SourceFileLoader,
142-
importlib.machinery.SOURCE_SUFFIXES, True)
141+
importlib.machinery.SOURCE_SUFFIXES)
143142
sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader))
144143
py_compile.compile(mapping[name])
145144
assert os.path.exists(imp.cache_from_source(mapping[name]))

0 commit comments

Comments
 (0)