From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 21 Jul 2025 16:58:32 +0000 (+0200) Subject: [3.13] Pedantic rewording of why relative importing doesn't work in main modules... X-Git-Tag: v3.13.6~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=de1c5e4f56bd347d0bb447b9d5a038bdff2d8729;p=thirdparty%2FPython%2Fcpython.git [3.13] Pedantic rewording of why relative importing doesn't work in main modules (GH-136846) (#136941) Pedantic rewording of why relative importing doesn't work in main modules (GH-136846) Pedantically reword the section about relative imports and main modules. (cherry picked from commit 4b68289ca6954b8d135e2ee2344e67fae38239fd) Co-authored-by: Josh Cannon --- diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index 47bf7547b4ae..f8105cd5441f 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -579,8 +579,8 @@ module for example, you might use:: from .. import formats from ..filters import equalizer -Note that relative imports are based on the name of the current module. Since -the name of the main module is always ``"__main__"``, modules intended for use +Note that relative imports are based on the name of the current module's package. +Since the main module does not have a package, modules intended for use as the main module of a Python application must always use absolute imports.