diff options
author | Thomas A Caswell <tcaswell@gmail.com> | 2020-07-11 12:16:16 -0400 |
---|---|---|
committer | Thomas A Caswell <tcaswell@gmail.com> | 2020-07-18 17:50:27 -0400 |
commit | be14f37b51a010f4c43b98f049dc48ac92ffa71f (patch) | |
tree | 26cd03653abd617cf7179b78806f2abc1bc4af50 | |
parent | a724ce89e37d00eddb20558dd383433071c07536 (diff) | |
download | numpy-be14f37b51a010f4c43b98f049dc48ac92ffa71f.tar.gz |
MNT: also use Py_SET_REFCNT instead of Py_REFCNT
This is required to support Python 3.10.
-rw-r--r-- | numpy/core/include/numpy/npy_3kcompat.h | 2 | ||||
-rw-r--r-- | numpy/core/src/multiarray/array_coercion.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/include/numpy/npy_3kcompat.h b/numpy/core/include/numpy/npy_3kcompat.h index 7e6b01924..4bc06fc96 100644 --- a/numpy/core/include/numpy/npy_3kcompat.h +++ b/numpy/core/include/numpy/npy_3kcompat.h @@ -65,6 +65,8 @@ static NPY_INLINE int PyInt_Check(PyObject *op) { #define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0) /* Introduced in https://github.com/python/cpython/commit/b10dc3e7a11fcdb97e285882eba6da92594f90f9 */ #define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0) + /* Introduced in https://github.com/python/cpython/commit/c86a11221df7e37da389f9c6ce6e47ea22dc44ff */ + #define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0) #endif diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c index 8fe996ed2..9285122b4 100644 --- a/numpy/core/src/multiarray/array_coercion.c +++ b/numpy/core/src/multiarray/array_coercion.c @@ -434,7 +434,7 @@ PyArray_Pack(PyArray_Descr *descr, char *item, PyObject *value) .flags = NPY_ARRAY_WRITEABLE, /* assume array is not behaved. */ }; Py_SET_TYPE(&arr_fields, &PyArray_Type); - Py_REFCNT(&arr_fields) = 1; + Py_SET_REFCNT(&arr_fields, 1); if (NPY_UNLIKELY(descr->type_num == NPY_OBJECT)) { /* |