[ python-Bugs-980092 ] tp_subclasses grow without bounds

SourceForge.net noreply at sourceforge.net
Fri Jun 25 20:54:45 EDT 2004


Bugs item #980092, was opened at 2004-06-25 17:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=980092&group_id=5470

Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Eric Huss (ehuss)
Assigned to: Nobody/Anonymous (nobody)
Summary: tp_subclasses grow without bounds

Initial Comment:
Python 2.3.4

When heap allocated type objects are created, they will 
be added to their base class's tp_subclasses list as a 
weak reference.  If, for example, your base type is 
PyBaseObject_Type, then the tp_subclasses list for the 
base object type will grow for each new object.

Unfortunately remove_subclass is never called.  If your 
newly create type objects are deleted, then you will end 
up with a bunch of weak reference objects in the 
tp_subclasses list that do not reference anything.

Perhaps remove_subclass should be called inside 
type_dealloc?  Or, better yet, tp_subclasses should be a 
Weak Set.  I'm not certain what's the best solution.



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

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



More information about the Python-bugs-list mailing list