Skip to content

Commit

Permalink
BUG: Stop using PyBytesObject.ob_shash deprecated in Python 3.11, fixes
Browse files Browse the repository at this point in the history
numpy#21317.

PyBytesObject.ob_shash was deprecated in Python 3.11.
  • Loading branch information
felixxm committed Apr 19, 2022
1 parent 55aacc7 commit 17c1c5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion numpy/core/src/multiarray/scalarapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,9 @@ PyArray_Scalar(void *data, PyArray_Descr *descr, PyObject *base)
if (PyTypeNum_ISFLEXIBLE(type_num)) {
if (type_num == NPY_STRING) {
destptr = PyBytes_AS_STRING(obj);
((PyBytesObject *)obj)->ob_shash = -1;
#if PY_VERSION_HEX < 0x030b00b0
((PyBytesObject *)obj)->ob_shash = -1;
#endif
memcpy(destptr, data, itemsize);
return obj;
}
Expand Down

0 comments on commit 17c1c5e

Please sign in to comment.