[Python-checkins] cpython (3.2): Issue #15142: Fix reference leak when deallocating instances of types created
antoine.pitrou
python-checkins at python.org
Sat Jun 23 14:48:54 CEST 2012
http://hg.python.org/cpython/rev/1794308c1ea7
changeset: 77628:1794308c1ea7
branch: 3.2
parent: 77623:e1416a4d728a
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Jun 23 14:42:38 2012 +0200
summary:
Issue #15142: Fix reference leak when deallocating instances of types created using PyType_FromSpec().
files:
Misc/NEWS | 3 +++
Objects/typeobject.c | 6 ++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
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
the work by Hirokazu Yamamoto.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -2387,6 +2387,12 @@
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;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list