GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-70319: Deprecate usage of load_module() by brettcannon · Pull Request #23469 · python/cpython

Conversation

@brettcannon

@brettcannon brettcannon commented Nov 22, 2020 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

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

  • Issue: Raise ImportWarning when loader.load_module() is used #70319

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
brettcannon added 11 commits October 22, 2020 17:28
@brettcannon
bpo-26131: deprecate the use of load_module()
4c7284c
@brettcannon
Fix a grammatical error in a comment
f05002b
@brettcannon
Merge branch 'master' into deprecate-load_module
0c09542
@brettcannon
Update to print out the loader's name in the ImportWarning
57f6a12
@brettcannon
Merge branch 'master' into deprecate-load_module
7c54914
@brettcannon
Deprecate zipimport's load_module() method
023cdaf
@brettcannon
Silence ImportWarning in test_venv
0a3d4c9
@brettcannon
Add a news entry for the zipimport deprecation
7a673ac
@brettcannon
Add a What's New entry for zipimport deprecation
15e6b70
@brettcannon
Tweak the deprecation message for zipimport
305d2a7
@brettcannon
Re-generate zipimport
5985e10
@brettcannon
brettcannon requested review from encukou, ericsnowcurrently, ncoghlan, vsajip and warsaw as code owners November 22, 2020 20:34
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Nov 22, 2020
@bedevere-bot bedevere-bot added the awaiting core review label Nov 22, 2020
@brettcannon

brettcannon commented Nov 22, 2020

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().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@brettcannon
Merge branch 'master' into deprecate-load_module
9575bc2
@brettcannon brettcannon added the 🤖 automerge label Dec 4, 2020
@brettcannon
brettcannon merged commit 2de5097 into python:master Dec 4, 2020
@brettcannon
brettcannon deleted the deprecate-load_module branch December 4, 2020 23:39
@bedevere-bot bedevere-bot removed the awaiting core review label Dec 4, 2020
@frenzymadness frenzymadness mentioned this pull request Dec 11, 2020
Implement create_module() and exec_module() for _SixMetaPathImporter benjaminp/six#341
Closed
This was referenced Dec 11, 2020
[Forward compatibility][BUG] pkg_resources.extern.VendorImporter lacks exec_module() method pypa/setuptools#2481
Closed
[Forward compatibility] Custom module finders must implement an exec_module() method ansible/ansible#72952
Closed
@blueyed blueyed mentioned this pull request Dec 19, 2020
ImportWarning: VendorImporter.exec_module() not found; falling back to load_module() pypa/packaging#375
Closed
@asottile asottile mentioned this pull request Jan 13, 2021
[4.6] Define create_module()/exec_module() in AssertionRewritingHook to avoid ImportWarning pytest-dev/pytest#8236
Closed
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
@brettcannon @adorilson
bpo-26131: Deprecate usage of load_module() (pythonGH-23469)
827db09
Raise an ImportWarning when the import system falls back on load_module(). As for implementations of load_module(), raise a DeprecationWarning.
@hugovk hugovk mentioned this pull request Aug 16, 2022
zipimporter find_module fullname mis-documented #52647
Closed
@tomasr8 tomasr8 mentioned this pull request Feb 8, 2025
gh-97850: Update the deprecation warning of importlib.abc.Loader.load_module #129855
Merged
@picnixz picnixz mentioned this pull request May 11, 2025
Remove deprecated importlib.load_module #133882
Open
@picnixz picnixz changed the title bpo-26131: Deprecate usage of load_module() gh-70319: Deprecate usage of load_module() May 11, 2025
@gaborbernat gaborbernat mentioned this pull request Jun 3, 2026
Remove private stdlib helpers orphaned by past removals #150882
Closed
gaborbernat added a commit to gaborbernat/cpython that referenced this pull request Jun 3, 2026
@gaborbernat
pythongh-150882: Remove unused importlib._bootstrap._object_name
ab23622
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.
This was referenced Jun 3, 2026
gh-150886: Remove unused importlib._bootstrap._object_name #150884
Merged
Remove unused private function importlib._bootstrap._object_name #150886
Closed
gaborbernat added a commit to gaborbernat/cpython that referenced this pull request Jun 3, 2026
@gaborbernat
pythongh-150886: Remove unused importlib._bootstrap._object_name
9ca2291
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
@gaborbernat
gh-150886: Remove unused importlib._bootstrap._object_name (#150884)
f906522
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
@gaborbernat @philthompson10
pythongh-150886: Remove unused importlib._bootstrap._object_name (pyt…
f484684
…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

Reviewers

@encukou encukou Awaiting requested review from encukou
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently
@ncoghlan ncoghlan Awaiting requested review from ncoghlan
@vsajip vsajip Awaiting requested review from vsajip
@warsaw warsaw Awaiting requested review from warsaw

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@brettcannon @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.