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-150886: Remove unused importlib._bootstrap._object_name by gaborbernat · Pull Request #150884 · python/cpython

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Jun 3, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

importlib._bootstrap._object_name() arrived in GH-23469 (bpo-26131) to render an object's qualified name inside the load_module() deprecation warnings. gh-142205 (GH-97850) removed load_module() and those warnings, deleting the last call site, so the private helper now has no caller.

Nothing in the repository references the name outside its own definition, and a GitHub code search turns up no downstream importer. Removing it from Lib/importlib/_bootstrap.py and regenerating the frozen module drops it from the runtime.

_object_name is private and undocumented, so this has no user-facing effect and needs no Misc/NEWS.d entry. The skip news label applies.

  • Issue: Remove unused private function importlib._bootstrap._object_name #150886

Sorry, something went wrong.

Uh oh!

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

All reactions
@gaborbernat
gaborbernat requested review from FFY00, brettcannon, ericsnowcurrently, ncoghlan and warsaw as code owners June 3, 2026 19:42
@bedevere-app bedevere-app Bot mentioned this pull request Jun 3, 2026
Remove private stdlib helpers orphaned by past removals #150882
Closed
@bedevere-app bedevere-app Bot added the awaiting review label 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.
@gaborbernat
gaborbernat force-pushed the deadcode/importlib-object-name branch from ab23622 to 9ca2291 Compare June 3, 2026 19:46
@gaborbernat gaborbernat changed the title gh-150882: Remove unused importlib._bootstrap._object_name gh-150886: Remove unused importlib._bootstrap._object_name Jun 3, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Jun 3, 2026
Remove unused private function importlib._bootstrap._object_name #150886
Closed
@picnixz

picnixz commented Jun 3, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I would be careful here. People arr known to use private functions of importlib even in private projects because sometimes there is not better replacement so I do not think we need to really remove it without a notificationat least. So please create a NEWS entry.

All reactions

Sorry, something went wrong.

Uh oh!

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

@gaborbernat
pythongh-150886: Add NEWS entry for _object_name removal
e3a8519
@gaborbernat

gaborbernat commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I've added a NEWS entry. On the broader concern: before proposing this I ran a GitHub code search for importlib._bootstrap._object_name and from importlib._bootstrap import _object_name and found no downstream importers, which is why I scoped the PR to just this symbol. It only rendered an object's qualname for the load_module() deprecation warnings that gh-142205 removed, so it has no remaining caller in or out of the tree that I can find. A code search only reaches public code though, so private users could exist that we will never see.

All reactions

Sorry, something went wrong.

Uh oh!

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

brettcannon
brettcannon approved these changes Jun 4, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jun 4, 2026
@brettcannon
Merge branch 'main' into deadcode/importlib-object-name
0ded62f
@brettcannon
brettcannon enabled auto-merge (squash) June 4, 2026 18:25
@brettcannon brettcannon self-assigned this Jun 4, 2026
@brettcannon
brettcannon merged commit f906522 into python:main Jun 4, 2026
95 of 97 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Jun 4, 2026
@bedevere-bot

bedevere-bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot x86-64 MacOS Intel ASAN NoGIL 3.x (tier-2) has failed when building commit f906522.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/1366/builds/7075) and take a look at the build logs.
  4. Check if the failure is related to this commit (f906522) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/1366/builds/7075

Failed tests:

  • test_logging

Failed subtests:

  • test_rollover_based_on_st_birthtime_only - test.test_logging.TimedRotatingFileHandlerTest.test_rollover_based_on_st_birthtime_only

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/buildarea/3.x.itamaro-macos-intel-aws.macos-with-brew.asan.nogil/build/Lib/test/test_logging.py", line 6666, in test_rollover_based_on_st_birthtime_only
    self.assertTrue(found, msg=msg)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: False is not true : No rotated files found, went back 5 seconds
All reactions

Sorry, something went wrong.

Uh oh!

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

@gaborbernat
gaborbernat deleted the deadcode/importlib-object-name branch June 4, 2026 22:44
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

@brettcannon brettcannon brettcannon approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner

Uh oh!

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

Assignees

@brettcannon brettcannon

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.

4 participants

@gaborbernat @picnixz @bedevere-bot @brettcannon
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.