[Python-bugs-list] [ python-Bugs-681122 ] Built-in function dir() causes refcount leak in baseclasses

SourceForge.net noreply@sourceforge.net
Wed, 05 Feb 2003 10:17:22 -0800


Bugs item #681122, was opened at 2003-02-05 19:17
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=681122&group_id=5470

Category: Python Library
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Troels Walsted Hansen (troels)
Assigned to: Nobody/Anonymous (nobody)
Summary: Built-in function dir() causes refcount leak in baseclasses

Initial Comment:
The bug appears to be present in Python 2.2.2 and 2.3a, 
but not in 2.2 or 2.2.1.

import sys

class Top:
    pass

class Bottom(Top):
    pass

print 'Refcount before:', sys.getrefcount(Top)
b=Bottom()
for i in range(1000):
    dir(b)
print 'Refcount after:', sys.getrefcount(Top)

$ ~/py221/bin/python refcount.py
Refcount before: 3
Refcount after: 3

$ ~/py222/bin/python refcount.py
Refcount before: 3
Refcount after: 1003

$ ~/py23a1/bin/python refcount.py
Refcount before: 3
Refcount after: 1003


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=681122&group_id=5470