[Python-Dev] Re: Evil Trashcan and GC interaction

Barry A. Warsaw barry@zope.com
Thu, 28 Mar 2002 13:42:12 -0500


>>>>> "NS" == Neil Schemenauer <nas@python.ca> writes:

    NS> There is insidious bug here.  Andrew helped me walk through it
    NS> and I think we figured it out.  First here's the code to
    NS> trigger it:

A simpler example:

    import gc

    class Ouch:
	def __del__(self):
	    gc.collect()

    def f():
	gc.set_threshold(5)
	while 1:
	    t = () # <-- here
	    for i in range(300):
		t = [t, Ouch()]
    f()

-Barry