Skip to content

Commit 1686141

Browse files
authored
Merge pull request numpy#21321 from felixxm/fix-21317
BUG: Stop using PyBytesObject.ob_shash deprecated in Python 3.11, fixes numpy#21317.
2 parents f55ab1b + 17c1c5e commit 1686141

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

numpy/core/src/multiarray/scalarapi.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,9 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
706706
if (PyTypeNum_ISFLEXIBLE(type_num)) {
707707
if (type_num == NPY_STRING) {
708708
destptr = PyBytes_AS_STRING(obj);
709-
((PyBytesObject *)obj)->ob_shash = -1;
709+
#if PY_VERSION_HEX < 0x030b00b0
710+
((PyBytesObject *)obj)->ob_shash = -1;
711+
#endif
710712
memcpy(destptr, data, itemsize);
711713
return obj;
712714
}

0 commit comments

Comments
 (0)