https://github.com/python/cpython/commit/f8147a031633b4778ef856fe4fccf325798df876
commit: f8147a031633b4778ef856fe4fccf325798df876
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: picnixz <[email protected]>
date: 2025-11-08T12:29:55Z
summary:

[3.13] gh-141004: correctly document `Py_HASH_*` and `PyHASH_*` as `hash_info` 
attributes (GH-141233) (#141235)

gh-141004: correctly document `Py_HASH_*` and `PyHASH_*` as `hash_info` 
attributes (GH-141233)
(cherry picked from commit 87942d911b8bc9e83caee3c0b699f0b0ba15daa9)

Co-authored-by: Bénédikt Tran <[email protected]>

files:
M Doc/c-api/hash.rst
M Doc/library/sys.rst

diff --git a/Doc/c-api/hash.rst b/Doc/c-api/hash.rst
index 884e1411ce7ff5..bfbd737c031340 100644
--- a/Doc/c-api/hash.rst
+++ b/Doc/c-api/hash.rst
@@ -56,6 +56,8 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
    it is easier to create colliding strings. A cutoff of 7 on 64-bit platforms
    and 5 on 32-bit platforms should provide a decent safety margin.
 
+   This corresponds to the :data:`sys.hash_info.cutoff` constant.
+
    .. versionadded:: 3.4
 
 
@@ -63,6 +65,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
 
    The `Mersenne prime <https://en.wikipedia.org/wiki/Mersenne_prime>`_ ``P = 
2**n -1``,
    used for numeric hash scheme.
+
    This corresponds to the :data:`sys.hash_info.modulus` constant.
 
    .. versionadded:: 3.13
@@ -71,7 +74,6 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
 .. c:macro:: PyHASH_BITS
 
    The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`.
-   This corresponds to the :data:`sys.hash_info.hash_bits` constant.
 
    .. versionadded:: 3.13
 
@@ -86,6 +88,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
 .. c:macro:: PyHASH_INF
 
    The hash value returned for a positive infinity.
+
    This corresponds to the :data:`sys.hash_info.inf` constant.
 
    .. versionadded:: 3.13
@@ -94,6 +97,7 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
 .. c:macro:: PyHASH_IMAG
 
    The multiplier used for the imaginary part of a complex number.
+
    This corresponds to the :data:`sys.hash_info.imag` constant.
 
    .. versionadded:: 3.13
@@ -111,14 +115,20 @@ See also the :c:member:`PyTypeObject.tp_hash` member and 
:ref:`numeric-hash`.
 
       Hash function name (UTF-8 encoded string).
 
+      This corresponds to the :data:`sys.hash_info.algorithm` constant.
+
    .. c:member:: const int hash_bits
 
       Internal size of the hash value in bits.
 
+      This corresponds to the :data:`sys.hash_info.hash_bits` constant.
+
    .. c:member:: const int seed_bits
 
       Size of seed input in bits.
 
+      This corresponds to the :data:`sys.hash_info.seed_bits` constant.
+
    .. versionadded:: 3.4
 
 
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index 66035e583b6014..efdf3f59e35bff 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -1096,10 +1096,14 @@ always available. Unless explicitly noted otherwise, 
all variables are read-only
 
       The size of the seed key of the hash algorithm
 
+   .. attribute:: hash_info.cutoff
+
+      Cutoff for small string DJBX33A optimization in range ``[1, cutoff)``.
+
    .. versionadded:: 3.2
 
    .. versionchanged:: 3.4
-      Added *algorithm*, *hash_bits* and *seed_bits*
+      Added *algorithm*, *hash_bits*, *seed_bits*, and *cutoff*.
 
 
 .. data:: hexversion

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to