mirror of
https://github.com/python/cpython.git
synced 2025-10-30 13:11:29 +00:00
gh-134891: Add PyUnstable_Unicode_GET_CACHED_HASH (GH-134892)
This commit is contained in:
parent
343182853f
commit
e413e26719
7 changed files with 55 additions and 5 deletions
|
|
@ -191,6 +191,22 @@ access to internal read-only data of Unicode objects:
|
|||
.. versionadded:: 3.2
|
||||
|
||||
|
||||
.. c:function:: Py_hash_t PyUnstable_Unicode_GET_CACHED_HASH(PyObject *str)
|
||||
|
||||
If the hash of *str*, as returned by :c:func:`PyObject_Hash`, has been
|
||||
cached and is immediately available, return it.
|
||||
Otherwise, return ``-1`` *without* setting an exception.
|
||||
|
||||
If *str* is not a string (that is, if ``PyUnicode_Check(obj)``
|
||||
is false), the behavior is undefined.
|
||||
|
||||
This function never fails with an exception.
|
||||
|
||||
Note that there are no guarantees on when an object's hash is cached,
|
||||
and the (non-)existence of a cached hash does not imply that the string has
|
||||
any other properties.
|
||||
|
||||
|
||||
Unicode Character Properties
|
||||
""""""""""""""""""""""""""""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue