Issue #13959: Have
importlib.abc.FileLoader.load_module()/get_filename() and
importlib.machinery.ExtensionFileLoader.load_module() have their
single argument be optional as the loader's constructor has all the
ncessary information.
This allows for the deprecation of
imp.load_source()/load_compile()/load_package().
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index ddfaa21..cac5251 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -256,9 +256,14 @@
Path to the file of the module.
+ .. method:: load_module(fullname=None)
+
+ Calls
+ ``super().load_module(fullname if fullname is not None else self.name)``.
+
.. method:: get_filename(fullname)
- Returns :attr:`path`.
+ Returns :attr:`path` when ``fullname`` equals :attr:`name` or ``None``.
.. method:: get_data(path)
@@ -638,10 +643,6 @@
Concrete implementation of :meth:`importlib.abc.SourceLoader.set_data`.
- .. method:: load_module(fullname)
-
- Load the specified module if it is the same as :attr:`name`.
-
.. class:: SourcelessFileLoader(fullname, path)
@@ -676,10 +677,6 @@
Returns ``None`` as bytecode files have no source when this loader is
used.
- .. method:: load_module(fullname)
-
- Loads the specified module if it is the same as :attr:`name`.
-
.. class:: ExtensionFileLoader(fullname, path)
@@ -699,10 +696,10 @@
Path to the extension module.
- .. method:: load_module(fullname)
+ .. method:: load_module(fullname=None)
- Loads the extension module if and only if *fullname** is the same as
- :attr:`name`.
+ Loads the extension module if and only if *fullname* is the same as
+ :attr:`name` or is ``None``.
.. method:: is_package(fullname)