Skip to content

gh-70319: Deprecate usage of load_module() - #23469

Merged
brettcannon merged 12 commits into
python:masterfrom
brettcannon:deprecate-load_module
Dec 4, 2020
Merged

brettcannon merged 12 commits into
python:masterfrom
brettcannon:deprecate-load_module

Conversation

@brettcannon

@brettcannon brettcannon commented Nov 22, 2020 •

Copy link
Copy Markdown
Member

Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.

https://bugs.python.org/issue26131

Automerge-Triggered-By: GH:brettcannon

@brettcannon

Copy link
Copy Markdown
Member Author

The key difference between this PR and #22905 is the addition of deprecating load_module() for zipimport and the changes to test_venv to make it all work while pip still has six without a fix for its lack of exec_module().

@picnixz picnixz changed the title bpo-26131: Deprecate usage of load_module() May 11, 2025
gaborbernat added a commit to gaborbernat/cpython that referenced this pull request Jun 3, 2026
Introduced in pythonGH-23469 (bpo-26131, "Deprecate usage of load_module()")
to render an object's qualified name inside the load_module()
deprecation warnings.

Orphaned by pythongh-142205 (pythonGH-97850, "Remove all uses and definitions of
load_module() from importlib"), which deleted the warning-building call
sites f"{_object_name(spec.loader)}.exec_module() not found; ..." and
left the helper with no caller.

A word-boundary search across Lib, Modules, Python, Objects and Include
finds zero references outside its own definition, and a GitHub code
search finds no downstream importers. The frozen importlib was
regenerated; importlib._bootstrap._object_name no longer exists at
runtime and the full test_importlib suite passes.
gaborbernat added a commit to gaborbernat/cpython that referenced this pull request Jun 3, 2026
Introduced in pythonGH-23469 (bpo-26131, "Deprecate usage of load_module()")
to render an object's qualified name inside the load_module()
deprecation warnings.

Orphaned by pythongh-142205 (pythonGH-97850, "Remove all uses and definitions of
load_module() from importlib"), which deleted the warning-building call
sites f"{_object_name(spec.loader)}.exec_module() not found; ..." and
left the helper with no caller.

A word-boundary search across Lib, Modules, Python, Objects and Include
finds zero references outside its own definition, and a GitHub code
search finds no downstream importers. The frozen importlib was
regenerated; importlib._bootstrap._object_name no longer exists at
runtime and the full test_importlib suite passes.
brettcannon pushed a commit that referenced this pull request Jun 4, 2026
Introduced in GH-23469 (bpo-26131, "Deprecate usage of load_module()")
to render an object's qualified name inside the load_module()
deprecation warnings.

Orphaned by gh-142205 (GH-97850, "Remove all uses and definitions of
load_module() from importlib"), which deleted the warning-building call
sites f"{_object_name(spec.loader)}.exec_module() not found; ..." and
left the helper with no caller.

A word-boundary search across Lib, Modules, Python, Objects and Include
finds zero references outside its own definition, and a GitHub code
search finds no downstream importers. The frozen importlib was
regenerated; importlib._bootstrap._object_name no longer exists at
runtime and the full test_importlib suite passes.
philthompson10 pushed a commit to philthompson10/cpython that referenced this pull request Jun 17, 2026
…hon#150884)

Introduced in pythonGH-23469 (bpo-26131, "Deprecate usage of load_module()")
to render an object's qualified name inside the load_module()
deprecation warnings.

Orphaned by pythongh-142205 (pythonGH-97850, "Remove all uses and definitions of
load_module() from importlib"), which deleted the warning-building call
sites f"{_object_name(spec.loader)}.exec_module() not found; ..." and
left the helper with no caller.

A word-boundary search across Lib, Modules, Python, Objects and Include
finds zero references outside its own definition, and a GitHub code
search finds no downstream importers. The frozen importlib was
regenerated; importlib._bootstrap._object_name no longer exists at
runtime and the full test_importlib suite passes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants