summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-03-22 18:19:10 (GMT)
committerGitHub <noreply@github.com>2024-03-22 18:19:10 (GMT)
commite2e0b4b4b92694ba894e02b4a66fd87c166ed10f (patch)
tree5ed883afb7db70957444e4df8adca74af54eef17 /Doc/c-api
parent567ab3bd15398c8c7b791f3e376ae3e3c0bbe079 (diff)
downloadcpython-e2e0b4b4b92694ba894e02b4a66fd87c166ed10f.zip
cpython-e2e0b4b4b92694ba894e02b4a66fd87c166ed10f.tar.gz
cpython-e2e0b4b4b92694ba894e02b4a66fd87c166ed10f.tar.bz2
gh-113024: C API: Add PyObject_GenericHash() function (GH-113025)
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/hash.rst11
-rw-r--r--Doc/c-api/typeobj.rst4
2 files changed, 15 insertions, 0 deletions
diff --git a/Doc/c-api/hash.rst b/Doc/c-api/hash.rst
index 1cf094c..ddf0b3e 100644
--- a/Doc/c-api/hash.rst
+++ b/Doc/c-api/hash.rst
@@ -82,3 +82,14 @@ See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`.
The function cannot fail: it cannot return ``-1``.
.. versionadded:: 3.13
+
+.. c:function:: Py_hash_t PyObject_GenericHash(PyObject *obj)
+
+ Generic hashing function that is meant to be put into a type
+ object's ``tp_hash`` slot.
+ Its result only depends on the object's identity.
+
+ .. impl-detail::
+ In CPython, it is equivalent to :c:func:`Py_HashPointer`.
+
+ .. versionadded:: 3.13
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index 8a26f23..e66ab01 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -883,6 +883,10 @@ and :c:data:`PyType_Type` effectively act as defaults.)
:c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash`, when the subtype's
:c:member:`~PyTypeObject.tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``.
+ **Default:**
+
+ :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`.
+
.. c:member:: ternaryfunc PyTypeObject.tp_call