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

@ -220,6 +220,12 @@ unicode_copycharacters(PyObject *self, PyObject *args)
return Py_BuildValue("(Nn)", to_copy, copied);
}
static PyObject*
unicode_GET_CACHED_HASH(PyObject *self, PyObject *arg)
{
return PyLong_FromSsize_t(PyUnstable_Unicode_GET_CACHED_HASH(arg));
}
// --- PyUnicodeWriter type -------------------------------------------------
@ -570,6 +576,7 @@ static PyMethodDef TestMethods[] = {
{"unicode_asucs4copy", unicode_asucs4copy, METH_VARARGS},
{"unicode_asutf8", unicode_asutf8, METH_VARARGS},
{"unicode_copycharacters", unicode_copycharacters, METH_VARARGS},
{"unicode_GET_CACHED_HASH", unicode_GET_CACHED_HASH, METH_O},
{NULL},
};