Skip to content

Commit f906522

Browse files
authored
gh-150886: Remove unused importlib._bootstrap._object_name (#150884)
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.
1 parent d4a8066 commit f906522

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
# reference any injected objects! This includes not only global code but also
2121
# anything specified at the class level.
2222

23-
def _object_name(obj):
24-
try:
25-
return obj.__qualname__
26-
except AttributeError:
27-
return type(obj).__qualname__
28-
2923
# Bootstrap-related code ######################################################
3024

3125
# Modules injected manually by _setup()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Remove the private, undocumented function
2+
``importlib._bootstrap._object_name()``. It had no caller after
3+
``load_module()`` and its deprecation warnings were removed from
4+
:mod:`importlib`.

0 commit comments

Comments
 (0)