mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
gh-113024: C API: Add PyObject_GenericHash() function (GH-113025)
This commit is contained in:
parent
567ab3bd15
commit
e2e0b4b4b9
14 changed files with 51 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue