mirror of https://github.com/python/cpython
Issue #15142: Fix reference leak when deallocating instances of types created using PyType_FromSpec().
This commit is contained in:
parent
b8dc3ab08b
commit
99cc629969
|
@ -10,6 +10,9 @@ What's New in Python 3.2.4
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #15142: Fix reference leak when deallocating instances of types
|
||||||
|
created using PyType_FromSpec().
|
||||||
|
|
||||||
- Issue #10053: Don't close FDs when FileIO.__init__ fails. Loosely based on
|
- Issue #10053: Don't close FDs when FileIO.__init__ fails. Loosely based on
|
||||||
the work by Hirokazu Yamamoto.
|
the work by Hirokazu Yamamoto.
|
||||||
|
|
||||||
|
|
|
@ -2387,6 +2387,12 @@ PyType_FromSpec(PyType_Spec *spec)
|
||||||
res->ht_type.tp_doc = tp_doc;
|
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)
|
if (PyType_Ready(&res->ht_type) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in New Issue