diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-23 12:42:38 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-23 12:42:38 (GMT) |
commit | 99cc629969cd008272c471a0f7bdd2de04cf67fa (patch) | |
tree | 9d826f145b887a2da66678e36888465d749c0f4f /Objects | |
parent | b8dc3ab08b6dfb089f37f417c9d507194d489882 (diff) | |
download | cpython-99cc629969cd008272c471a0f7bdd2de04cf67fa.zip cpython-99cc629969cd008272c471a0f7bdd2de04cf67fa.tar.gz cpython-99cc629969cd008272c471a0f7bdd2de04cf67fa.tar.bz2 |
Issue #15142: Fix reference leak when deallocating instances of types created using PyType_FromSpec().
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 934d06f..54a990e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2387,6 +2387,12 @@ PyType_FromSpec(PyType_Spec *spec) res->ht_type.tp_doc = tp_doc; } } + if (res->ht_type.tp_dealloc == NULL) { + /* It's a heap type, so needs the heap types' dealloc. + subtype_dealloc will call the base type's tp_dealloc, if + necessary. */ + res->ht_type.tp_dealloc = subtype_dealloc; + } if (PyType_Ready(&res->ht_type) < 0) goto fail; |