diff options
-rw-r--r-- | Doc/whatsnew/3.12.rst | 2 | ||||
-rw-r--r-- | Tools/importbench/importbench.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index fcfd034..4849f8c 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1368,6 +1368,8 @@ Removed * The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :gh:`98040`.) + * Replace ``imp.new_module(name)`` with ``types.ModuleType(name)``. + * Removed the ``suspicious`` rule from the documentation Makefile, and removed ``Doc/tools/rstlint.py``, both in favor of `sphinx-lint <https://github.com/sphinx-contrib/sphinx-lint>`_. 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): |