[Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.15,1.113.4.16

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Tue, 04 Jun 2002 14:19:57 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv27530/Lib/test

Modified Files:
      Tag: release22-maint
	test_descr.py 
Log Message:
Backport to 2.2.x:

Address SF bug 519621: slots weren't traversed by GC.

While I was at it, I added a tp_clear handler and changed the
tp_dealloc handler to use the clear_slots helper for the tp_clear
handler.

Also set mp->flags = READONLY for the __weakref__ pseudo-slot.

[Note that I am *not* backporting the part of that patch that
tightened the __slot__ rules.]



Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.113.4.15
retrieving revision 1.113.4.16
diff -C2 -d -r1.113.4.15 -r1.113.4.16
*** test_descr.py	13 May 2002 18:30:40 -0000	1.113.4.15
--- test_descr.py	4 Jun 2002 21:19:55 -0000	1.113.4.16
***************
*** 1094,1097 ****
--- 1094,1109 ----
      vereq(Counted.counter, 0)
  
+     # Test cyclical leaks [SF bug 519621]
+     class F(object):
+         __slots__ = ['a', 'b']
+     log = []
+     s = F()
+     s.a = [Counted(), s]
+     vereq(Counted.counter, 1)
+     s = None
+     import gc
+     gc.collect()
+     vereq(Counted.counter, 0)
+ 
  def dynamics():
      if verbose: print "Testing class attribute propagation..."