Skip to content

Commit 34f4fa8

Browse files
authored
gh-141226: Deprecate PEP-456 support for embedders (#141287)
Deprecate PEP-456 [1] support for providing an external definition of the string hashing scheme. Removal is scheduled for Python 3.19. Previously, embedders could define the ``Py_HASH_ALGORITHM`` macro to be ``Py_HASH_EXTERNAL`` [2] to indicate that the hashing scheme was provided externally but this feature was undocumented, untested and most likely unused. [1]: https://peps.python.org/pep-0456/ [2]: https://peps.python.org/pep-0456/#hash-function-selection
1 parent 3a2a686 commit 34f4fa8

File tree

5 files changed

+22
-1
lines changed

5 files changed

+22
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Pending removal in Python 3.19
2+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3+
4+
* :pep:`456` embedders support for the string hashing scheme definition.

Doc/deprecations/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ C API deprecations
2020

2121
.. include:: c-api-pending-removal-in-3.15.rst
2222

23+
.. include:: c-api-pending-removal-in-3.16.rst
24+
2325
.. include:: c-api-pending-removal-in-3.18.rst
2426

27+
.. include:: c-api-pending-removal-in-3.19.rst
28+
2529
.. include:: c-api-pending-removal-in-3.20.rst
2630

2731
.. include:: c-api-pending-removal-in-future.rst

Doc/whatsnew/3.15.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,16 @@ on Python 3.13 and older.
17231723
Deprecated C APIs
17241724
-----------------
17251725

1726+
* Deprecate :pep:`456` support for providing an external definition
1727+
of the string hashing scheme. Removal is scheduled for Python 3.19.
1728+
1729+
Previously, embedders could define :c:macro:`Py_HASH_ALGORITHM` to be
1730+
``Py_HASH_EXTERNAL`` to indicate that the hashing scheme was provided
1731+
externally but this feature was undocumented, untested and most likely
1732+
unused.
1733+
1734+
(Contributed by Bénédikt Tran in :gh:`141226`.)
1735+
17261736
* For unsigned integer formats in :c:func:`PyArg_ParseTuple`,
17271737
accepting Python integers with value that is larger than the maximal value
17281738
for the C type or less than the minimal value for the corresponding
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Deprecate :pep:`456` support for providing an external definition
2+
of the string hashing scheme. Removal is scheduled for Python 3.19.
3+
Patch by Bénédikt Tran.

Python/pyhash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
_Py_HashSecret_t _Py_HashSecret = {{0}};
1818

1919
#if Py_HASH_ALGORITHM == Py_HASH_EXTERNAL
20-
extern PyHash_FuncDef PyHash_Func;
20+
Py_DEPRECATED(3.15) extern PyHash_FuncDef PyHash_Func;
2121
#else
2222
static PyHash_FuncDef PyHash_Func;
2323
#endif

0 commit comments

Comments
 (0)