From 7cad5cc9152b30e62301665f243dc4dcad2e9806 Mon Sep 17 00:00:00 2001 From: Satyam Kumar Verman Date: Tue, 25 Nov 2025 03:44:36 +0000 Subject: [PATCH 1/2] docs fixes --- Doc/tutorial/modules.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index f8105cd5441fec..c28cec00a802a7 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -205,12 +205,17 @@ More details are at :ref:`sys-path-init`. script is calculated after the symlink is followed. In other words the directory containing the symlink is **not** added to the module search path. -After initialization, Python programs can modify :data:`sys.path`. The -directory containing the script being run is placed at the beginning of the -search path, ahead of the standard library path. This means that scripts in that -directory will be loaded instead of modules of the same name in the library -directory. This is an error unless the replacement is intended. See section -:ref:`tut-standardmodules` for more information. + After initialization, Python programs may modify :data:sys.path directly. This + can be useful in some situations, but it may also lead to import-related issues + if misused. + + Independently of any manual changes, Python automatically places the directory + containing the executed script at the beginning of the module search path. + Because this entry precedes the standard library path, modules in the script + directory can shadow standard library modules of the same name. This is usually + unintended and can lead to confusing errors. See section :ref:tut-standardmodules + for more information. + .. % Do we need stuff on zip files etc. ? DUBOIS From 449543842caf91857e3757157d1f22f29cc6d0c9 Mon Sep 17 00:00:00 2001 From: Satyam Kumar Verman Date: Tue, 25 Nov 2025 10:58:15 +0000 Subject: [PATCH 2/2] add changes --- Doc/tutorial/modules.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst index c28cec00a802a7..85f39dfef70bcd 100644 --- a/Doc/tutorial/modules.rst +++ b/Doc/tutorial/modules.rst @@ -205,7 +205,7 @@ More details are at :ref:`sys-path-init`. script is calculated after the symlink is followed. In other words the directory containing the symlink is **not** added to the module search path. - After initialization, Python programs may modify :data:sys.path directly. This + After initialization, Python programs may modify :data:`sys.path` directly. This can be useful in some situations, but it may also lead to import-related issues if misused. @@ -213,7 +213,7 @@ More details are at :ref:`sys-path-init`. containing the executed script at the beginning of the module search path. Because this entry precedes the standard library path, modules in the script directory can shadow standard library modules of the same name. This is usually - unintended and can lead to confusing errors. See section :ref:tut-standardmodules + unintended and can lead to confusing errors. See section :ref:`tut-standardmodules` for more information.