mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-131510: Use PyUnstable_Unicode_GET_CACHED_HASH() (GH-141520)
Replace code that directly accesses PyASCIIObject.hash with PyUnstable_Unicode_GET_CACHED_HASH(). Remove redundant "assert(PyUnicode_Check(op))" from PyUnstable_Unicode_GET_CACHED_HASH(), _PyASCIIObject_CAST() already implements the check.
This commit is contained in:
parent
181a2f4f2e
commit
3bacae5598
4 changed files with 3 additions and 6 deletions
|
|
@ -863,8 +863,7 @@ static inline Py_hash_t
|
|||
_PyObject_HashFast(PyObject *op)
|
||||
{
|
||||
if (PyUnicode_CheckExact(op)) {
|
||||
Py_hash_t hash = FT_ATOMIC_LOAD_SSIZE_RELAXED(
|
||||
_PyASCIIObject_CAST(op)->hash);
|
||||
Py_hash_t hash = PyUnstable_Unicode_GET_CACHED_HASH(op);
|
||||
if (hash != -1) {
|
||||
return hash;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue