From 46bd556b6a08e999175b20ff18e4a0bf36f4f181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sun, 9 Nov 2025 15:53:34 +0100 Subject: [PATCH 1/4] Deprecate PEP 456 support for embedders --- Doc/deprecations/c-api-pending-removal-in-3.17.rst | 4 ++++ Doc/deprecations/index.rst | 4 ++++ Doc/whatsnew/3.15.rst | 12 ++++++++++++ .../2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst | 3 +++ Python/pyhash.c | 2 +- 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 Doc/deprecations/c-api-pending-removal-in-3.17.rst create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst diff --git a/Doc/deprecations/c-api-pending-removal-in-3.17.rst b/Doc/deprecations/c-api-pending-removal-in-3.17.rst new file mode 100644 index 00000000000000..646afbf0b078f2 --- /dev/null +++ b/Doc/deprecations/c-api-pending-removal-in-3.17.rst @@ -0,0 +1,4 @@ +Pending removal in Python 3.17 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* :pep:`456` embedders support for the string hashing scheme definition. diff --git a/Doc/deprecations/index.rst b/Doc/deprecations/index.rst index f3cecb321d633f..7579121c0633ff 100644 --- a/Doc/deprecations/index.rst +++ b/Doc/deprecations/index.rst @@ -18,6 +18,10 @@ C API deprecations .. include:: c-api-pending-removal-in-3.15.rst +.. include:: c-api-pending-removal-in-3.16.rst + +.. include:: c-api-pending-removal-in-3.17.rst + .. include:: c-api-pending-removal-in-3.18.rst .. include:: c-api-pending-removal-in-3.20.rst diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 5379ac3abba227..8a7acef98ae6a4 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -844,6 +844,18 @@ Deprecated New deprecations ---------------- +* Build: + + * Deprecate :pep:`456` support for providing an external definition + of the string hashing scheme. Removal is scheduled for Python 3.17. + + Previously, embedders could define :c:macro:`Py_HASH_ALGORITHM` to be + ``Py_HASH_EXTERNAL`` to indicate that the hashing scheme was provided + externally but this feature was undocumented, untested and most likely + unused. + + (Contributed by Bénédikt Tran in :gh:`141226`.) + * CLI: * Deprecate :option:`-b` and :option:`!-bb` command-line options diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst new file mode 100644 index 00000000000000..60bc9b201a45f3 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst @@ -0,0 +1,3 @@ +Deprecate :pep:`456` support for providing an external definition +of the string hashing scheme. Removal is scheduled for Python 3.17. +Patch by Bénédikt Tran. diff --git a/Python/pyhash.c b/Python/pyhash.c index 216f437dd9a2d4..b6b4ee225c097e 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -17,7 +17,7 @@ _Py_HashSecret_t _Py_HashSecret = {{0}}; #if Py_HASH_ALGORITHM == Py_HASH_EXTERNAL -extern PyHash_FuncDef PyHash_Func; +Py_DEPRECATED(3.15) extern PyHash_FuncDef PyHash_Func; #else static PyHash_FuncDef PyHash_Func; #endif From bc00153e6867a365ecea9c36b4bbca8b0681763d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 7 Feb 2026 12:37:47 +0100 Subject: [PATCH 2/4] defer removal to Python 3.19 --- ...-removal-in-3.17.rst => c-api-pending-removal-in-3.19.rst} | 2 +- Doc/deprecations/index.rst | 4 ++-- Doc/whatsnew/3.15.rst | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename Doc/deprecations/{c-api-pending-removal-in-3.17.rst => c-api-pending-removal-in-3.19.rst} (77%) diff --git a/Doc/deprecations/c-api-pending-removal-in-3.17.rst b/Doc/deprecations/c-api-pending-removal-in-3.19.rst similarity index 77% rename from Doc/deprecations/c-api-pending-removal-in-3.17.rst rename to Doc/deprecations/c-api-pending-removal-in-3.19.rst index 646afbf0b078f2..ac9dcb8b424a17 100644 --- a/Doc/deprecations/c-api-pending-removal-in-3.17.rst +++ b/Doc/deprecations/c-api-pending-removal-in-3.19.rst @@ -1,4 +1,4 @@ -Pending removal in Python 3.17 +Pending removal in Python 3.19 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * :pep:`456` embedders support for the string hashing scheme definition. diff --git a/Doc/deprecations/index.rst b/Doc/deprecations/index.rst index aa2e07dcc87480..bb8bfb5c227c2d 100644 --- a/Doc/deprecations/index.rst +++ b/Doc/deprecations/index.rst @@ -22,10 +22,10 @@ C API deprecations .. include:: c-api-pending-removal-in-3.16.rst -.. include:: c-api-pending-removal-in-3.17.rst - .. include:: c-api-pending-removal-in-3.18.rst +.. include:: c-api-pending-removal-in-3.19.rst + .. include:: c-api-pending-removal-in-3.20.rst .. include:: c-api-pending-removal-in-future.rst diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index 58a1653d59b03e..fac5ffeecde7b5 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -1313,7 +1313,7 @@ New deprecations * Build: * Deprecate :pep:`456` support for providing an external definition - of the string hashing scheme. Removal is scheduled for Python 3.17. + of the string hashing scheme. Removal is scheduled for Python 3.19. Previously, embedders could define :c:macro:`Py_HASH_ALGORITHM` to be ``Py_HASH_EXTERNAL`` to indicate that the hashing scheme was provided From 07e32b019997a6bde04d42b44540d76900cf95ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 7 Feb 2026 12:38:53 +0100 Subject: [PATCH 3/4] fixup --- .../2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst index 60bc9b201a45f3..3f7ce7326187d4 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-11-09-15-44-58.gh-issue-141226.KTb_3F.rst @@ -1,3 +1,3 @@ Deprecate :pep:`456` support for providing an external definition -of the string hashing scheme. Removal is scheduled for Python 3.17. +of the string hashing scheme. Removal is scheduled for Python 3.19. Patch by Bénédikt Tran. From 077d808d1977c5512a5c3162926e2e98ad5527ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Sat, 7 Feb 2026 12:42:00 +0100 Subject: [PATCH 4/4] move deprecation notice under the C API section instead --- Doc/whatsnew/3.15.rst | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Doc/whatsnew/3.15.rst b/Doc/whatsnew/3.15.rst index fac5ffeecde7b5..29009c61b218a8 100644 --- a/Doc/whatsnew/3.15.rst +++ b/Doc/whatsnew/3.15.rst @@ -1310,18 +1310,6 @@ Deprecated New deprecations ---------------- -* Build: - - * Deprecate :pep:`456` support for providing an external definition - of the string hashing scheme. Removal is scheduled for Python 3.19. - - Previously, embedders could define :c:macro:`Py_HASH_ALGORITHM` to be - ``Py_HASH_EXTERNAL`` to indicate that the hashing scheme was provided - externally but this feature was undocumented, untested and most likely - unused. - - (Contributed by Bénédikt Tran in :gh:`141226`.) - * :mod:`base64`: * Accepting the ``+`` and ``/`` characters with an alternative alphabet in @@ -1550,6 +1538,16 @@ on Python 3.13 and older. Deprecated C APIs ----------------- +* Deprecate :pep:`456` support for providing an external definition + of the string hashing scheme. Removal is scheduled for Python 3.19. + + Previously, embedders could define :c:macro:`Py_HASH_ALGORITHM` to be + ``Py_HASH_EXTERNAL`` to indicate that the hashing scheme was provided + externally but this feature was undocumented, untested and most likely + unused. + + (Contributed by Bénédikt Tran in :gh:`141226`.) + * For unsigned integer formats in :c:func:`PyArg_ParseTuple`, accepting Python integers with value that is larger than the maximal value for the C type or less than the minimal value for the corresponding