From 5fb40eeab1b24a7e0496f8d2dda484aa0ffff387 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 3 May 2026 20:30:18 -0700 Subject: [PATCH 1/5] Flesh out PEP 829 for What's New --- Doc/whatsnew/3.15.rst | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 53628b2ff46cfc..4a53f4e5d34040 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -91,7 +91,7 @@ Summary -- Release highlights * :ref:`Improved error messages ` * :ref:`The official Windows 64-bit binaries now use the tail-calling interpreter ` -* :pep:`829`: Package Startup Configuration Files +* :pep:`829`: :ref:`Package Startup Configuration Files ` New features ============ @@ -449,6 +449,31 @@ If not using a build tool -- or when writing such a tool -- you can select in :ref:`abi3-compiling`. +.. _whatsnew315-startup-files: + +:pep:`829`: Startup Configuration Files +--------------------------------------- + +Loaded by the :mod:`site` module when ``-S`` is not given, :file:`.pth` files +can contain lines that both extend :data:`sys.path` and execute arbitrary code +when the line starts with ``import`` (followed by a space or tab). The latter +functionality can be problematic, since it is difficult to know exactly what +gets executed when Python starts up. + +As a step towards improving the ability to audit pre-start executable code, +Python 3.15 introduces :file:`.start` files which contain entry point +specifications of the form ``pkg.mod:callable`` where ``pkg.mod`` is the +import path to the given callable. When Python starts up, the callable is +located and called with no arguments. + +``import`` lines in :file:`.pth` files are silently deprecated. When a +matching :file:`.start` file is found, ``import`` lines in :file:`.pth` files +are ignored. There is no change to :data:`sys.path` extension lines in +:file:`.pth` files. + +(Contributed by Barry Warsaw in :gh:`148641`.) + + .. _whatsnew315-improved-error-messages: Improved error messages From 0d1070b7a58cb0e7d9d233c47203f778bd797743 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 4 May 2026 08:33:30 -0700 Subject: [PATCH 2/5] Update Doc/whatsnew/3.15.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/whatsnew/3.15.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index b1b2c084d3c0c4..15422089b2b50c 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -91,7 +91,7 @@ Summary -- Release highlights * :ref:`Improved error messages ` * :ref:`The official Windows 64-bit binaries now use the tail-calling interpreter ` -* :pep:`829`: :ref:`Package Startup Configuration Files ` +* :pep:`829`: :ref:`Package startup configuration files ` New features ============ From d330ef4ba90c308829bd3284ab469f57edd543a6 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 4 May 2026 08:35:03 -0700 Subject: [PATCH 3/5] Update Doc/whatsnew/3.15.rst Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- Doc/whatsnew/3.15.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 15422089b2b50c..ad926deda6b316 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -454,8 +454,8 @@ in :ref:`abi3-compiling`. .. _whatsnew315-startup-files: -:pep:`829`: Startup Configuration Files ---------------------------------------- +:pep:`829`: Package startup configuration files +----------------------------------------------- Loaded by the :mod:`site` module when ``-S`` is not given, :file:`.pth` files can contain lines that both extend :data:`sys.path` and execute arbitrary code From 32c9865781f6e55588d4f16aa2ee7a76f0c15fdc Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 6 May 2026 14:06:20 +0300 Subject: [PATCH 4/5] Move PEP 829 before the typing PEPs block --- Doc/whatsnew/3.15.rst | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index ad926deda6b316..d16bf21202691a 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -79,6 +79,7 @@ Summary -- Release highlights ` * :pep:`686`: :ref:`Python now uses UTF-8 as the default encoding ` +* :pep:`829`: :ref:`Package startup configuration files ` * :pep:`728`: ``TypedDict`` with typed extra items * :pep:`747`: :ref:`Annotating type forms with TypeForm ` @@ -91,7 +92,6 @@ Summary -- Release highlights * :ref:`Improved error messages ` * :ref:`The official Windows 64-bit binaries now use the tail-calling interpreter ` -* :pep:`829`: :ref:`Package startup configuration files ` New features ============ @@ -416,6 +416,31 @@ agen() for x in a)``. (Contributed by Adam Hartz in :gh:`143055`.) +.. _whatsnew315-startup-files: + +:pep:`829`: Package startup configuration files +----------------------------------------------- + +Loaded by the :mod:`site` module when ``-S`` is not given, :file:`.pth` files +can contain lines that both extend :data:`sys.path` and execute arbitrary code +when the line starts with ``import`` (followed by a space or tab). The latter +functionality can be problematic, since it is difficult to know exactly what +gets executed when Python starts up. + +As a step towards improving the ability to audit pre-start executable code, +Python 3.15 introduces :file:`.start` files which contain entry point +specifications of the form ``pkg.mod:callable`` where ``pkg.mod`` is the +import path to the given callable. When Python starts up, the callable is +located and called with no arguments. + +``import`` lines in :file:`.pth` files are silently deprecated. When a +matching :file:`.start` file is found, ``import`` lines in :file:`.pth` files +are ignored. There is no change to :data:`sys.path` extension lines in +:file:`.pth` files. + +(Contributed by Barry Warsaw in :gh:`148641`.) + + .. _whatsnew315-abi3t: :pep:`803`: ``abi3t`` -- Stable ABI for Free-Threaded Builds @@ -452,31 +477,6 @@ If not using a build tool -- or when writing such a tool -- you can select in :ref:`abi3-compiling`. -.. _whatsnew315-startup-files: - -:pep:`829`: Package startup configuration files ------------------------------------------------ - -Loaded by the :mod:`site` module when ``-S`` is not given, :file:`.pth` files -can contain lines that both extend :data:`sys.path` and execute arbitrary code -when the line starts with ``import`` (followed by a space or tab). The latter -functionality can be problematic, since it is difficult to know exactly what -gets executed when Python starts up. - -As a step towards improving the ability to audit pre-start executable code, -Python 3.15 introduces :file:`.start` files which contain entry point -specifications of the form ``pkg.mod:callable`` where ``pkg.mod`` is the -import path to the given callable. When Python starts up, the callable is -located and called with no arguments. - -``import`` lines in :file:`.pth` files are silently deprecated. When a -matching :file:`.start` file is found, ``import`` lines in :file:`.pth` files -are ignored. There is no change to :data:`sys.path` extension lines in -:file:`.pth` files. - -(Contributed by Barry Warsaw in :gh:`148641`.) - - .. _whatsnew315-improved-error-messages: Improved error messages From e372f817398af03442f6727d4245164a68565fc9 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Wed, 6 May 2026 14:13:36 +0300 Subject: [PATCH 5/5] Link to .pth and .start files docs --- Doc/whatsnew/3.15.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 101735248dd050..1a5e5fe2fc0be6 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -457,14 +457,14 @@ agen() for x in a)``. :pep:`829`: Package startup configuration files ----------------------------------------------- -Loaded by the :mod:`site` module when ``-S`` is not given, :file:`.pth` files +Loaded by the :mod:`site` module when ``-S`` is not given, :ref:`.pth files ` can contain lines that both extend :data:`sys.path` and execute arbitrary code when the line starts with ``import`` (followed by a space or tab). The latter functionality can be problematic, since it is difficult to know exactly what gets executed when Python starts up. As a step towards improving the ability to audit pre-start executable code, -Python 3.15 introduces :file:`.start` files which contain entry point +Python 3.15 introduces :ref:`.start files ` which contain entry point specifications of the form ``pkg.mod:callable`` where ``pkg.mod`` is the import path to the given callable. When Python starts up, the callable is located and called with no arguments.