File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ What's New in Python 3.2.4
1010Core and Builtins
1111-----------------
1212
13+ - Issue #15142: Fix reference leak when deallocating instances of types
14+ created using PyType_FromSpec().
15+
1316- Issue #10053: Don't close FDs when FileIO.__init__ fails. Loosely based on
1417 the work by Hirokazu Yamamoto.
1518
Original file line number Diff line number Diff line change @@ -2387,6 +2387,12 @@ PyType_FromSpec(PyType_Spec *spec)
23872387 res -> ht_type .tp_doc = tp_doc ;
23882388 }
23892389 }
2390+ if (res -> ht_type .tp_dealloc == NULL ) {
2391+ /* It's a heap type, so needs the heap types' dealloc.
2392+ subtype_dealloc will call the base type's tp_dealloc, if
2393+ necessary. */
2394+ res -> ht_type .tp_dealloc = subtype_dealloc ;
2395+ }
23902396
23912397 if (PyType_Ready (& res -> ht_type ) < 0 )
23922398 goto fail ;
You can’t perform that action at this time.
0 commit comments