From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:16:13 +0000 (-0700) Subject: [3.12] GH-109190: Copyedit 3.12 What's New: Update the ``imp`` porting guidance ... X-Git-Tag: v3.12.0~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=52b2f9f66855c18c41e494ab9402f6e16b738c74;p=thirdparty%2FPython%2Fcpython.git [3.12] GH-109190: Copyedit 3.12 What's New: Update the ``imp`` porting guidance (GH-109755) (#109816) GH-109190: Copyedit 3.12 What's New: Update the ``imp`` porting guidance (GH-109755) (cherry picked from commit 7b8bfe1644c3d008c1b5c19a537ee7d19bc32c59) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index c2e7068ce096..285cd4f9f779 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1410,7 +1410,7 @@ imp * The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :gh:`98040`.) -* Replace removed :mod:`!imp` functions with :mod:`importlib` functions: + To migrate, consult the following correspondence table: ================================= ======================================= imp importlib @@ -1425,9 +1425,10 @@ imp ``imp.new_module(name)`` ``types.ModuleType(name)`` ``imp.reload()`` :func:`importlib.reload` ``imp.source_from_cache()`` :func:`importlib.util.source_from_cache` + ``imp.load_source()`` *See below* ================================= ======================================= -* Replace ``imp.load_source()`` with:: + Replace ``imp.load_source()`` with:: import importlib.util import importlib.machinery