mirror of
https://github.com/python/cpython.git
synced 2025-09-30 04:15:43 +00:00
[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 7b8bfe1644
)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
cb4a8c273d
commit
52b2f9f668
1 changed files with 3 additions and 2 deletions
|
@ -1410,7 +1410,7 @@ imp
|
||||||
* The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in
|
* The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in
|
||||||
:gh:`98040`.)
|
:gh:`98040`.)
|
||||||
|
|
||||||
* Replace removed :mod:`!imp` functions with :mod:`importlib` functions:
|
To migrate, consult the following correspondence table:
|
||||||
|
|
||||||
================================= =======================================
|
================================= =======================================
|
||||||
imp importlib
|
imp importlib
|
||||||
|
@ -1425,9 +1425,10 @@ imp
|
||||||
``imp.new_module(name)`` ``types.ModuleType(name)``
|
``imp.new_module(name)`` ``types.ModuleType(name)``
|
||||||
``imp.reload()`` :func:`importlib.reload`
|
``imp.reload()`` :func:`importlib.reload`
|
||||||
``imp.source_from_cache()`` :func:`importlib.util.source_from_cache`
|
``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.util
|
||||||
import importlib.machinery
|
import importlib.machinery
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue