Kaydet (Commit) a4db02c7 authored tarafından Antoine Pitrou's avatar Antoine Pitrou

Issue #15142: Fix reference leak when deallocating instances of types created…

Issue #15142: Fix reference leak when deallocating instances of types created using PyType_FromSpec().
......@@ -10,6 +10,9 @@ What's New in Python 3.3.0 Beta 1?
Core and Builtins
-----------------
- Issue #15142: Fix reference leak when deallocating instances of types
created using PyType_FromSpec().
- Issue #15042: Add PyState_AddModule and PyState_RemoveModule. Add version
guard for Py_LIMITED_API additions. Patch by Robin Schreiber.
......
......@@ -2417,6 +2417,12 @@ PyType_FromSpec(PyType_Spec *spec)
if (res->ht_type.tp_dictoffset) {
res->ht_cached_keys = _PyDict_NewKeysForClass();
}
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment