diff options
author | Eddie Elizondo <eduardo.elizondorueda@gmail.com> | 2019-03-27 11:52:18 (GMT) |
---|---|---|
committer | Petr Viktorin <encukou@gmail.com> | 2019-03-27 11:52:18 (GMT) |
commit | 364f0b0f19cc3f0d5e63f571ec9163cf41c62958 (patch) | |
tree | 977c0c418780824cca9ef9b4d920b9d423253e84 /Objects/structseq.c | |
parent | 1fc5bf2ff27b898e8d9460d0fbc791e83009ed71 (diff) | |
download | cpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.zip cpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.tar.gz cpython-364f0b0f19cc3f0d5e63f571ec9163cf41c62958.tar.bz2 |
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
Diffstat (limited to 'Objects/structseq.c')
-rw-r--r-- | Objects/structseq.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c index cf36fa7..a5046c4 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -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] |