GH-98040: Suppress cross-references to the removed ``imp`` module (#104131)

Suppress cross-references to imp
This commit is contained in:
Adam Turner 2023-05-03 13:29:42 +01:00 committed by GitHub
parent 326997829d
commit 328435ed42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 19 deletions

View File

@ -186,10 +186,10 @@ Importing Modules
.. versionadded:: 3.2 .. versionadded:: 3.2
.. versionchanged:: 3.3 .. versionchanged:: 3.3
Uses :func:`imp.source_from_cache()` in calculating the source path if Uses :func:`!imp.source_from_cache()` in calculating the source path if
only the bytecode path is provided. only the bytecode path is provided.
.. versionchanged:: 3.12 .. versionchanged:: 3.12
No longer uses the removed ``imp`` module. No longer uses the removed :mod:`!imp` module.
.. c:function:: long PyImport_GetMagicNumber() .. c:function:: long PyImport_GetMagicNumber()

View File

@ -1987,6 +1987,7 @@ are always available. They are listed here in alphabetical order.
.. index:: .. index::
statement: import statement: import
module: builtins
.. note:: .. note::

View File

@ -840,7 +840,7 @@ Builtins
need it; however, 99 percent of the time an explicit :keyword:`for` need it; however, 99 percent of the time an explicit :keyword:`for`
loop is more readable. loop is more readable.
* Removed :func:`reload`. Use :func:`imp.reload`. * Removed :func:`reload`. Use :func:`!imp.reload`.
* Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator * Removed. :meth:`dict.has_key` -- use the :keyword:`in` operator
instead. instead.

View File

@ -1682,7 +1682,7 @@ Deprecated
classes as appropriate instead. classes as appropriate instead.
(Contributed by Brett Cannon in :issue:`42135`.) (Contributed by Brett Cannon in :issue:`42135`.)
* The deprecations of :mod:`imp`, :func:`!importlib.find_loader`, * The deprecations of :mod:`!imp`, :func:`!importlib.find_loader`,
:func:`importlib.util.set_package_wrapper`, :func:`importlib.util.set_package_wrapper`,
:func:`importlib.util.set_loader_wrapper`, :func:`importlib.util.set_loader_wrapper`,
:func:`importlib.util.module_for_loader`, :func:`importlib.util.module_for_loader`,

View File

@ -1872,7 +1872,7 @@ C APIs pending removal are
* The :mod:`asynchat` module * The :mod:`asynchat` module
* The :mod:`asyncore` module * The :mod:`asyncore` module
* The :ref:`entire distutils package <distutils-deprecated>` * The :ref:`entire distutils package <distutils-deprecated>`
* The :mod:`imp` module * The :mod:`!imp` module
* The :class:`typing.io <typing.IO>` namespace * The :class:`typing.io <typing.IO>` namespace
* The :class:`typing.re <typing.Pattern>` namespace * The :class:`typing.re <typing.Pattern>` namespace
* :func:`!cgi.log` * :func:`!cgi.log`

View File

@ -995,7 +995,7 @@ Removed
* ``importlib.abc.Finder``, ``pkg.ImpImporter``, and ``pkg.ImpLoader`` have * ``importlib.abc.Finder``, ``pkg.ImpImporter``, and ``pkg.ImpLoader`` have
been removed. (Contributed by Barry Warsaw in :gh:`98040`.) been removed. (Contributed by Barry Warsaw in :gh:`98040`.)
* The ``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`.)
* Removed the ``suspicious`` rule from the documentation Makefile, and * Removed the ``suspicious`` rule from the documentation Makefile, and

View File

@ -319,7 +319,7 @@ aspects that are visible to the programmer:
>>> collections.__cached__ # doctest: +SKIP >>> collections.__cached__ # doctest: +SKIP
'c:/py32/lib/__pycache__/collections.cpython-32.pyc' 'c:/py32/lib/__pycache__/collections.cpython-32.pyc'
* The tag that is unique to each interpreter is accessible from the :mod:`imp` * The tag that is unique to each interpreter is accessible from the :mod:`!imp`
module: module:
>>> import imp # doctest: +SKIP >>> import imp # doctest: +SKIP
@ -328,7 +328,7 @@ aspects that are visible to the programmer:
* Scripts that try to deduce source filename from the imported file now need to * Scripts that try to deduce source filename from the imported file now need to
be smarter. It is no longer sufficient to simply strip the "c" from a ".pyc" be smarter. It is no longer sufficient to simply strip the "c" from a ".pyc"
filename. Instead, use the new functions in the :mod:`imp` module: filename. Instead, use the new functions in the :mod:`!imp` module:
>>> imp.source_from_cache('c:/py32/lib/__pycache__/collections.cpython-32.pyc') # doctest: +SKIP >>> imp.source_from_cache('c:/py32/lib/__pycache__/collections.cpython-32.pyc') # doctest: +SKIP
'c:/py32/lib/collections.py' 'c:/py32/lib/collections.py'

View File

@ -685,7 +685,7 @@ through normal attribute access.
Using importlib as the Implementation of Import Using importlib as the Implementation of Import
=============================================== ===============================================
:issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`2377` - Replace __import__ w/ importlib.__import__
:issue:`13959` - Re-implement parts of :mod:`imp` in pure Python :issue:`13959` - Re-implement parts of :mod:`!imp` in pure Python
:issue:`14605` - Make import machinery explicit :issue:`14605` - Make import machinery explicit
:issue:`14646` - Require loaders set __loader__ and __package__ :issue:`14646` - Require loaders set __loader__ and __package__
@ -762,7 +762,7 @@ Loaders are also now expected to set the ``__package__`` attribute from
from :mod:`importlib` and import itself is setting the attribute post-load. from :mod:`importlib` and import itself is setting the attribute post-load.
``None`` is now inserted into :attr:`sys.path_importer_cache` when no finder ``None`` is now inserted into :attr:`sys.path_importer_cache` when no finder
can be found on :attr:`sys.path_hooks`. Since :class:`imp.NullImporter` is not can be found on :attr:`sys.path_hooks`. Since :class:`!imp.NullImporter` is not
directly exposed on :attr:`sys.path_hooks` it could no longer be relied upon to directly exposed on :attr:`sys.path_hooks` it could no longer be relied upon to
always be available to use as a value representing no finder found. always be available to use as a value representing no finder found.
@ -2385,7 +2385,7 @@ Porting Python code
* Because ``None`` is now inserted into :attr:`sys.path_importer_cache`, if you * Because ``None`` is now inserted into :attr:`sys.path_importer_cache`, if you
are clearing out entries in the dictionary of paths that do not have a are clearing out entries in the dictionary of paths that do not have a
finder, you will need to remove keys paired with values of ``None`` **and** finder, you will need to remove keys paired with values of ``None`` **and**
:class:`imp.NullImporter` to be backwards-compatible. This will lead to extra :class:`!imp.NullImporter` to be backwards-compatible. This will lead to extra
overhead on older versions of Python that re-insert ``None`` into overhead on older versions of Python that re-insert ``None`` into
:attr:`sys.path_importer_cache` where it represents the use of implicit :attr:`sys.path_importer_cache` where it represents the use of implicit
finders, but semantically it should not change anything. finders, but semantically it should not change anything.

View File

@ -991,18 +991,18 @@ for the :meth:`~importlib.abc.InspectLoader.get_code` method. However,
it will normally be desirable to override the default implementation it will normally be desirable to override the default implementation
for performance reasons. (Contributed by Brett Cannon in :issue:`18072`.) for performance reasons. (Contributed by Brett Cannon in :issue:`18072`.)
The :func:`~importlib.reload` function has been moved from :mod:`imp` to The :func:`~importlib.reload` function has been moved from :mod:`!imp` to
:mod:`importlib` as part of the :mod:`imp` module deprecation. (Contributed by :mod:`importlib` as part of the :mod:`!imp` module deprecation. (Contributed by
Berker Peksag in :issue:`18193`.) Berker Peksag in :issue:`18193`.)
:mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` attribute :mod:`importlib.util` now has a :data:`~importlib.util.MAGIC_NUMBER` attribute
providing access to the bytecode version number. This replaces the providing access to the bytecode version number. This replaces the
:func:`~imp.get_magic` function in the deprecated :mod:`imp` module. :func:`!get_magic` function in the deprecated :mod:`!imp` module.
(Contributed by Brett Cannon in :issue:`18192`.) (Contributed by Brett Cannon in :issue:`18192`.)
New :mod:`importlib.util` functions :func:`~importlib.util.cache_from_source` New :mod:`importlib.util` functions :func:`~importlib.util.cache_from_source`
and :func:`~importlib.util.source_from_cache` replace the same-named functions and :func:`~importlib.util.source_from_cache` replace the same-named functions
in the deprecated :mod:`imp` module. (Contributed by Brett Cannon in in the deprecated :mod:`!imp` module. (Contributed by Brett Cannon in
:issue:`18194`.) :issue:`18194`.)
The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to The :mod:`importlib` bootstrap :class:`.NamespaceLoader` now conforms to
@ -2101,7 +2101,7 @@ Deprecations in the Python API
and :meth:`importlib.util.set_package` are no longer needed because their and :meth:`importlib.util.set_package` are no longer needed because their
functions are now handled automatically by the import system. functions are now handled automatically by the import system.
* The :mod:`imp` module is pending deprecation. To keep compatibility with * The :mod:`!imp` module is pending deprecation. To keep compatibility with
Python 2/3 code bases, the module's removal is currently not scheduled. Python 2/3 code bases, the module's removal is currently not scheduled.
* The :mod:`formatter` module is pending deprecation and is slated for removal * The :mod:`formatter` module is pending deprecation and is slated for removal
@ -2300,7 +2300,7 @@ Changes in the Python API
then you can see if the module's ``__spec__.location`` is set to ``'frozen'``, then you can see if the module's ``__spec__.location`` is set to ``'frozen'``,
check if the loader is a subclass of check if the loader is a subclass of
:class:`importlib.machinery.FrozenImporter`, :class:`importlib.machinery.FrozenImporter`,
or if Python 2 compatibility is necessary you can use :func:`imp.is_frozen`. or if Python 2 compatibility is necessary you can use :func:`!imp.is_frozen`.
* :func:`py_compile.compile` now raises :exc:`FileExistsError` if the file path * :func:`py_compile.compile` now raises :exc:`FileExistsError` if the file path
it would write to is a symlink or a non-regular file. This is to act as a it would write to is a symlink or a non-regular file. This is to act as a

View File

@ -2180,7 +2180,7 @@ Changes in the Python API
now raises :exc:`ValueError` for out-of-range values, rather than now raises :exc:`ValueError` for out-of-range values, rather than
returning :const:`None`. See :issue:`20059`. returning :const:`None`. See :issue:`20059`.
* The :mod:`imp` module now raises a :exc:`DeprecationWarning` instead of * The :mod:`!imp` module now raises a :exc:`DeprecationWarning` instead of
:exc:`PendingDeprecationWarning`. :exc:`PendingDeprecationWarning`.
* The following modules have had missing APIs added to their :attr:`__all__` * The following modules have had missing APIs added to their :attr:`__all__`

View File

@ -3818,7 +3818,7 @@ user.
.. section: Library .. section: Library
The :2to3fixer:`reload` fixer now uses :func:`importlib.reload` instead of The :2to3fixer:`reload` fixer now uses :func:`importlib.reload` instead of
deprecated :func:`imp.reload`. deprecated :func:`!imp.reload`.
.. ..