[New-bugs-announce] [issue16690] Reference leak with custom tp_dealloc in PyType_FromSpec

Bradley Froehle report at bugs.python.org
Sat Dec 15 02:39:25 CET 2012

New submission from Bradley Froehle:

There is a reference leak when using PyType_FromSpec with custom tp_dealloc.  This was first noted in issue #15142, where a fix was given which only applies to types which do not override tp_dealloc.

For example, the xxlimited.Xxo type suffers from this:

Python 3.3.0 (default, Oct 26 2012, 11:06:17) 
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import xxlimited
>>> import sys
>>> Xxo = type(xxlimited.new())
>>> e = Xxo()
>>> sys.getrefcount(Xxo)
>>> e = Xxo()
>>> sys.getrefcount(Xxo)
>>> e = Xxo()
>>> sys.getrefcount(Xxo)

components: Interpreter Core
messages: 177527
nosy: bfroehle
priority: normal
severity: normal
status: open
title: Reference leak with custom tp_dealloc in PyType_FromSpec
type: resource usage
versions: Python 3.2, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list