Skip to content

Commit

Permalink
Revert Py_SET_TYPE to earlier implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
icanhasmath committed Apr 3, 2024
1 parent 88e411f commit 20cc5c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions numpy/core/src/multiarray/_multiarray_tests.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -659,15 +659,17 @@ create_custom_field_dtype(PyObject *NPY_UNUSED(mod), PyObject *args)
* Test that we reject this if the type is not set to something that
* we are pretty sure can be safely replaced.
*/
Py_SET_TYPE(dtype, scalar_type);
Py_TYPE(dtype) = scalar_type;
dtype->ob_type = scalar_type;
}
else if (error_path != 0) {
PyErr_SetString(PyExc_ValueError,
"invalid error argument to test function.");
}
if (PyArray_RegisterDataType(dtype) < 0) {
/* Fix original type in the error_path == 2 case and delete it */
Py_SET_TYPE(dtype, original_type);
Py_TYPE(dtype) = original_type;
dtype->ob_type = original_type;
Py_DECREF(dtype);
return NULL;
}
Expand Down

0 comments on commit 20cc5c9

Please sign in to comment.