bpo-42134: Raise ImportWarning when calling find_module() in the import system (GH-25044)

This commit is contained in:
Brett Cannon 2021-03-30 08:43:03 -07:00 committed by GitHub
parent cf35e05f89
commit a7ff6df60c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1012 additions and 962 deletions

View file

@ -329,6 +329,10 @@ modules, and one that knows how to import modules from an :term:`import path`
import machinery will try it only if the finder does not implement
``find_spec()``.
.. versionchanged:: 3.10
Use of :meth:`~importlib.abc.MetaPathFinder.find_module` by the import system
now raises :exc:`ImportWarning`.
Loading
=======
@ -470,6 +474,9 @@ import machinery will create the new module itself.
An :exc:`ImportError` is raised when ``exec_module()`` is defined but
``create_module()`` is not.
.. versionchanged:: 3.10
Use of ``load_module()`` will raise :exc:`ImportWarning`.
Submodules
----------
@ -896,6 +903,10 @@ a list containing the portion.
exist on a path entry finder, the import system will always call
``find_loader()`` in preference to ``find_module()``.
.. versionchanged:: 3.10
Calls to :meth:`~importlib.abc.PathEntryFinder.find_module` by the import
system will raise :exc:`ImportWarning`.
Replacing the standard import system
====================================