pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/commit/457a459c7804950d4c27a243b176eb933ec87a06

b48faa60c69660fa.css" /> gh-98040: Fix importbench: use types.ModuleType() (#105743) · python/cpython@457a459 · GitHub
Skip to content

Commit 457a459

Browse files
authored
gh-98040: Fix importbench: use types.ModuleType() (#105743)
Replace removed imp.new_module(name) with types.ModuleType(name).
1 parent 757b402 commit 457a459

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Doc/whatsnew/3.12.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,8 @@ Removed
13691369
* The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in
13701370
:gh:`98040`.)
13711371

1372+
* Replace ``imp.new_module(name)`` with ``types.ModuleType(name)``.
1373+
13721374
* Removed the ``suspicious`` rule from the documentation Makefile, and
13731375
removed ``Doc/tools/rstlint.py``, both in favor of `sphinx-lint
13741376
<https://github.com/sphinx-contrib/sphinx-lint>`_.

Tools/importbench/importbench.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import sys
1616
import tabnanny
1717
import timeit
18+
import types
1819

1920

2021
def bench(name, cleanup=lambda: None, *, seconds=1, repeat=3):
@@ -40,7 +41,7 @@ def bench(name, cleanup=lambda: None, *, seconds=1, repeat=3):
4041
def from_cache(seconds, repeat):
4142
"""sys.modules"""
4243
name = '<benchmark import>'
43-
module = imp.new_module(name)
44+
module = types.ModuleType(name)
4445
module.__file__ = '<test>'
4546
module.__package__ = ''
4647
with util.uncache(name):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy