mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
bpo-35810: Incref heap-allocated types in PyObject_Init (GH-11661)
* Incref heap-allocated types in PyObject_Init * Add documentation and porting notes to What's New
This commit is contained in:
parent
1fc5bf2ff2
commit
364f0b0f19
8 changed files with 89 additions and 10 deletions
|
|
@ -138,6 +138,9 @@ _PyObject_INIT(PyObject *op, PyTypeObject *typeobj)
|
|||
{
|
||||
assert(op != NULL);
|
||||
Py_TYPE(op) = typeobj;
|
||||
if (PyType_GetFlags(typeobj) & Py_TPFLAGS_HEAPTYPE) {
|
||||
Py_INCREF(typeobj);
|
||||
}
|
||||
_Py_NewReference(op);
|
||||
return op;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue