Commit eae30790 authored by Brett Cannon's avatar Brett Cannon

Issue #25802: Deprecate load_module() on importlib.machinery.SourceFileLoader...

Issue #25802: Deprecate load_module() on importlib.machinery.SourceFileLoader and SourcelessFileLoader.

They were the only remaining implementations of load_module() not
documented as deprecated.
parent 53d1f244
...@@ -921,6 +921,10 @@ find and load modules. ...@@ -921,6 +921,10 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional. specifying the name of the module to load is optional.
.. deprecated:: 3.6
Use :meth:`importlib.abc.Loader.exec_module` instead.
.. class:: SourcelessFileLoader(fullname, path) .. class:: SourcelessFileLoader(fullname, path)
...@@ -960,6 +964,10 @@ find and load modules. ...@@ -960,6 +964,10 @@ find and load modules.
Concrete implementation of :meth:`importlib.abc.Loader.load_module` where Concrete implementation of :meth:`importlib.abc.Loader.load_module` where
specifying the name of the module to load is optional. specifying the name of the module to load is optional.
.. deprecated:: 3.6
Use :meth:`importlib.abc.Loader.exec_module` instead.
.. class:: ExtensionFileLoader(fullname, path) .. class:: ExtensionFileLoader(fullname, path)
......
...@@ -189,7 +189,12 @@ become proper keywords in Python 3.7. ...@@ -189,7 +189,12 @@ become proper keywords in Python 3.7.
Deprecated Python modules, functions and methods Deprecated Python modules, functions and methods
------------------------------------------------ ------------------------------------------------
* None yet. * :meth:`importlib.machinery.SourceFileLoader` and
:meth:`importlib.machinery.SourcelessFileLoader` are now deprecated. They
were the only remaining implementations of
:meth:`importlib.abc.Loader.load_module` in :mod:`importlib` that had not
been deprecated in previous versions of Python in favour of
:meth:`importlib.abc.Loader.exec_module`.
Deprecated functions and types of the C API Deprecated functions and types of the C API
......
...@@ -655,6 +655,7 @@ class _LoaderBasics: ...@@ -655,6 +655,7 @@ class _LoaderBasics:
_bootstrap._call_with_frames_removed(exec, code, module.__dict__) _bootstrap._call_with_frames_removed(exec, code, module.__dict__)
def load_module(self, fullname): def load_module(self, fullname):
"""This module is deprecated."""
return _bootstrap._load_module_shim(self, fullname) return _bootstrap._load_module_shim(self, fullname)
......
...@@ -123,6 +123,9 @@ Core and Builtins ...@@ -123,6 +123,9 @@ Core and Builtins
Library Library
------- -------
- Issue #25802: Document as deprecated the remaining implementations of
importlib.abc.Loader.load_module().
- Issue #25928: Add Decimal.as_integer_ratio(). - Issue #25928: Add Decimal.as_integer_ratio().
- Issue #25447: Copying the lru_cache() wrapper object now always works, - Issue #25447: Copying the lru_cache() wrapper object now always works,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment