mirror of
https://github.com/python/cpython.git
synced 2025-08-27 04:05:34 +00:00
bpo-39573: Add Py_SET_TYPE() function (GH-18394)
Add Py_SET_TYPE() function to set the type of an object.
This commit is contained in:
parent
daa9756cb6
commit
d2ec81a8c9
24 changed files with 77 additions and 48 deletions
|
@ -144,7 +144,7 @@ PyObject_Init(PyObject *op, PyTypeObject *tp)
|
|||
return PyErr_NoMemory();
|
||||
}
|
||||
|
||||
Py_TYPE(op) = tp;
|
||||
Py_SET_TYPE(op, tp);
|
||||
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
|
||||
Py_INCREF(tp);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue