bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
diff --git a/Modules/_testbuffer.c b/Modules/_testbuffer.c
index 047e3d3..600a52a 100644
--- a/Modules/_testbuffer.c
+++ b/Modules/_testbuffer.c
@@ -2835,11 +2835,11 @@
if (m == NULL)
return NULL;
- Py_TYPE(&NDArray_Type) = &PyType_Type;
+ Py_SET_TYPE(&NDArray_Type, &PyType_Type);
Py_INCREF(&NDArray_Type);
PyModule_AddObject(m, "ndarray", (PyObject *)&NDArray_Type);
- Py_TYPE(&StaticArray_Type) = &PyType_Type;
+ Py_SET_TYPE(&StaticArray_Type, &PyType_Type);
Py_INCREF(&StaticArray_Type);
PyModule_AddObject(m, "staticarray", (PyObject *)&StaticArray_Type);