8000 Merge pull request #16899 from tacaswell/mnt_more_py310 · numpy/numpy@a0028bc · GitHub
[go: up one dir, main page]

Skip to content

Commit a0028bc

Browse files
authored
Merge pull request #16899 from tacaswell/mnt_more_py310
MNT: also use Py_SET_REFCNT instead of Py_REFCNT
2 parents 9765987 + be14f37 commit a0028bc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

numpy/core/include/numpy/npy_3kcompat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ static NPY_INLINE int PyInt_Check(PyObject *op) {
6565
#define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
6666
/* Introduced in https://github.com/python/cpython/commit/b10dc3e7a11fcdb97e285882eba6da92594f90f9 */
6767
#define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0)
68+
/* Introduced in https://github.com/python/cpython/commit/c86a11221df7e37da389f9c6ce6e47ea22dc44ff */
69+
#define Py_SET_REFCNT(obj, refcnt) ((Py_REFCNT(obj) = (refcnt)), (void)0)
6870
#endif
6971

7072

numpy/core/src/multiarray/array_coercion.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ PyArray_Pack(PyArray_Descr *descr, char *item, PyObject *value)
434434
.flags = NPY_ARRAY_WRITEABLE, /* assume array is not behaved. */
435435
};
436436
Py_SET_TYPE(&arr_fields, &PyArray_Type);
437-
Py_REFCNT(&arr_fields) = 1;
437+
Py_SET_REFCNT(&arr_fields, 1);
438438

439439
if (NPY_UNLIKELY(descr->type_num == NPY_OBJECT)) {
440440
/*

0 commit comments

Comments
 (0)
0