diff options
author | Victor Stinner <vstinner@python.org> | 2024-08-30 15:42:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-30 15:42:27 (GMT) |
commit | d8e69b2c1b3388c31a6083cfdd9dc9afff5b9860 (patch) | |
tree | eb78955c066631fdd52b00ddfd26d4fb676f9e36 /Objects | |
parent | 3d60dfbe1755e00ab20d0ee81281886be77ad5da (diff) | |
download | cpython-d8e69b2c1b3388c31a6083cfdd9dc9afff5b9860.zip cpython-d8e69b2c1b3388c31a6083cfdd9dc9afff5b9860.tar.gz cpython-d8e69b2c1b3388c31a6083cfdd9dc9afff5b9860.tar.bz2 |
gh-122854: Add Py_HashBuffer() function (#122855)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 2 | ||||
-rw-r--r-- | Objects/codeobject.c | 4 | ||||
-rw-r--r-- | Objects/memoryobject.c | 2 | ||||
-rw-r--r-- | Objects/unicodeobject.c | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index c467b24..4a7c21f 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -1598,7 +1598,7 @@ _Py_COMP_DIAG_PUSH _Py_COMP_DIAG_IGNORE_DEPR_DECLS if (a->ob_shash == -1) { /* Can't fail */ - a->ob_shash = _Py_HashBytes(a->ob_sval, Py_SIZE(a)); + a->ob_shash = Py_HashBuffer(a->ob_sval, Py_SIZE(a)); } return a->ob_shash; _Py_COMP_DIAG_POP diff --git a/Objects/codeobject.c b/Objects/codeobject.c index ef24b51..6f0b3f8 100644 --- a/Objects/codeobject.c +++ b/Objects/codeobject.c @@ -2561,12 +2561,12 @@ hash_const(const void *key) if (PySlice_Check(op)) { PySliceObject *s = (PySliceObject *)op; PyObject *data[3] = { s->start, s->stop, s->step }; - return _Py_HashBytes(&data, sizeof(data)); + return Py_HashBuffer(&data, sizeof(data)); } else if (PyTuple_CheckExact(op)) { Py_ssize_t size = PyTuple_GET_SIZE(op); PyObject **data = _PyTuple_ITEMS(op); - return _Py_HashBytes(data, sizeof(PyObject *) * size); + return Py_HashBuffer(data, sizeof(PyObject *) * size); } Py_hash_t h = PyObject_Hash(op); if (h == -1) { diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c index 226bd6d..498a37c 100644 --- a/Objects/memoryobject.c +++ b/Objects/memoryobject.c @@ -3087,7 +3087,7 @@ memory_hash(PyObject *_self) } /* Can't fail */ - self->hash = _Py_HashBytes(mem, view->len); + self->hash = Py_HashBuffer(mem, view->len); if (mem != view->buf) PyMem_Free(mem); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f4239ce..fc1fb78 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -11688,7 +11688,7 @@ unicode_hash(PyObject *self) if (hash != -1) { return hash; } - x = _Py_HashBytes(PyUnicode_DATA(self), + x = Py_HashBuffer(PyUnicode_DATA(self), PyUnicode_GET_LENGTH(self) * PyUnicode_KIND(self)); FT_ATOMIC_STORE_SSIZE_RELAXED(_PyUnicode_HASH(self), x); |