From 8c3914aef47e6e5a31b48a0b1f165ec3f4dc4c98 Mon Sep 17 00:00:00 2001 From: Yair Frid Date: Thu, 7 Jan 2021 20:06:13 +0200 Subject: [3.9] bpo-42811: Update importlib.utils.resolve_name() docs to use __spec__.parent (GH-24100) (GH-24149) This is a backport of https://github.com/python/cpython/pull/24100 Automerge-Triggered-By: GH:brettcannon --- Doc/library/importlib.rst | 2 +- Misc/NEWS.d/next/Documentation/2021-01-07-12-08-59.bpo-42811.ePF7EC.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Documentation/2021-01-07-12-08-59.bpo-42811.ePF7EC.rst diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst index 305bb54..cb2a568 100644 --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -1473,7 +1473,7 @@ an :term:`importer`. If **name** has no leading dots, then **name** is simply returned. This allows for usage such as - ``importlib.util.resolve_name('sys', __package__)`` without doing a + ``importlib.util.resolve_name('sys', __spec__.parent)`` without doing a check to see if the **package** argument is needed. :exc:`ImportError` is raised if **name** is a relative module name but diff --git a/Misc/NEWS.d/next/Documentation/2021-01-07-12-08-59.bpo-42811.ePF7EC.rst b/Misc/NEWS.d/next/Documentation/2021-01-07-12-08-59.bpo-42811.ePF7EC.rst new file mode 100644 index 0000000..179c065 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2021-01-07-12-08-59.bpo-42811.ePF7EC.rst @@ -0,0 +1,2 @@ +Updated importlib.utils.resolve_name() doc to use __spec__.parent instead of +__package__. (Thanks Yair Frid.) -- cgit v0.12