summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-06-13 22:32:12 (GMT)
committerGitHub <noreply@github.com>2023-06-13 22:32:12 (GMT)
commit457a459c7804950d4c27a243b176eb933ec87a06 (patch)
tree8733adfbd8c12c6be2bfb91b90f45e7a8faee397 /Tools
parent757b402ea1c2c6b925a55a08fd844b065b6e082f (diff)
downloadcpython-457a459c7804950d4c27a243b176eb933ec87a06.zip
cpython-457a459c7804950d4c27a243b176eb933ec87a06.tar.gz
cpython-457a459c7804950d4c27a243b176eb933ec87a06.tar.bz2
gh-98040: Fix importbench: use types.ModuleType() (#105743)
Replace removed imp.new_module(name) with types.ModuleType(name).
Diffstat (limited to 'Tools')
-rw-r--r--Tools/importbench/importbench.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Tools/importbench/importbench.py b/Tools/importbench/importbench.py
index 619263b..0c4b3bc 100644
--- a/Tools/importbench/importbench.py
+++ b/Tools/importbench/importbench.py
@@ -15,6 +15,7 @@ import py_compile
import sys
import tabnanny
import timeit
+import types
def bench(name, cleanup=lambda: None, *, seconds=1, repeat=3):
@@ -40,7 +41,7 @@ def bench(name, cleanup=lambda: None, *, seconds=1, repeat=3):
def from_cache(seconds, repeat):
"""sys.modules"""
name = '<benchmark import>'
- module = imp.new_module(name)
+ module = types.ModuleType(name)
module.__file__ = '<test>'
module.__package__ = ''
with util.uncache(name):