gh-134891: Add PyUnstable_Unicode_GET_CACHED_HASH (GH-134892)

This commit is contained in:
Petr Viktorin 2025-06-06 15:51:00 +02:00 committed by GitHub
parent 343182853f
commit e413e26719
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 55 additions and 5 deletions

View file

@ -167,11 +167,7 @@ static inline void PyUnicode_SET_UTF8_LENGTH(PyObject *op, Py_ssize_t length)
#define _PyUnicode_HASH(op) \
(_PyASCIIObject_CAST(op)->hash)
static inline Py_hash_t PyUnicode_HASH(PyObject *op)
{
assert(_PyUnicode_CHECK(op));
return FT_ATOMIC_LOAD_SSIZE_RELAXED(_PyASCIIObject_CAST(op)->hash);
}
#define PyUnicode_HASH PyUnstable_Unicode_GET_CACHED_HASH
static inline void PyUnicode_SET_HASH(PyObject *op, Py_hash_t hash)
{