Skip to content

Commit 8c3914a

Browse files
authored
[3.9] bpo-42811: Update importlib.utils.resolve_name() docs to use __spec__.parent (GH-24100) (GH-24149)
This is a backport of #24100 Automerge-Triggered-By: GH:brettcannon
1 parent 49c150f commit 8c3914a

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Doc/library/importlib.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ an :term:`importer`.
14731473

14741474
If **name** has no leading dots, then **name** is simply returned. This
14751475
allows for usage such as
1476-
``importlib.util.resolve_name('sys', __package__)`` without doing a
1476+
``importlib.util.resolve_name('sys', __spec__.parent)`` without doing a
14771477
check to see if the **package** argument is needed.
14781478

14791479
:exc:`ImportError` is raised if **name** is a relative module name but
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Updated importlib.utils.resolve_name() doc to use __spec__.parent instead of
2+
__package__. (Thanks Yair Frid.)

0 commit comments

Comments
 (0)