8000 MNT: also use Py_SET_REFCNT instead of Py_REFCNT by tacaswell · Pull Request #16899 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

MNT: also use Py_SET_REFCNT instead of Py_REFCNT #16899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
10000
Failed to load files.
Loading
Diff view
Diff view
MNT: also use Py_SET_REFCNT instead of Py_REFCNT
This is required to support Python 3.10.
  • Loading branch information
tacaswell committed Jul 18, 2020
commit be14f37b51a010f4c43b98f049dc48ac92ffa71f
2 changes: 2 additions & 0 deletions numpy/core/include/numpy/npy_3kcompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion numpy/core/src/multiarray/array_coercion.c 78BC
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
/*
Expand Down
0