From 5fb40eeab1b24a7e0496f8d2dda484aa0ffff387 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 3 May 2026 20:30:18 -0700 Subject: [PATCH 1/2] 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/2] 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 ============