[issue9417] Declaring a class creates circular references

Kay Hayen report at bugs.python.org
Sat Apr 25 06:58:24 EDT 2020


Kay Hayen <kay.hayen at gmail.com> added the comment:

Today I changed my reference count tests to not use debug Python and came across this issue.

>From my testing, Python3.4 is the first affected version, Python3.3 was still fine, so were 2.7 and 2.6. 

This leaks:

def simpleFunction39():
    class Parent(str):
        pass

This does not:

def simpleFunction39():
    class Parent(object):
        pass

When comparing (or attempted to) gc.get_objects() before and after, I was unable to point to any count that would be different, that was confusing. I can rule out a mistake in my changes to how the counts are achieved, because every other reference count test works.

----------
nosy: +kayhayen

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue9417>
_______________________________________


More information about the Python-bugs-list mailing list