mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -63,12 +63,17 @@ static void
|
|||
structseq_dealloc(PyStructSequence *obj)
|
||||
{
|
||||
Py_ssize_t i, size;
|
||||
PyTypeObject *tp;
|
||||
|
||||
tp = (PyTypeObject *) Py_TYPE(obj);
|
||||
size = REAL_SIZE(obj);
|
||||
for (i = 0; i < size; ++i) {
|
||||
Py_XDECREF(obj->ob_item[i]);
|
||||
}
|
||||
PyObject_GC_Del(obj);
|
||||
if (PyType_GetFlags(tp) & Py_TPFLAGS_HEAPTYPE) {
|
||||
Py_DECREF(tp);
|
||||
}
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue