[Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.21,1.113.4.22

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
Thu, 11 Jul 2002 11:30:04 -0700


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

Modified Files:
      Tag: release22-maint
	test_descr.py 
Log Message:
subtype_resurrection():  The test suite with -l properly reported the
immortal object here as a leak.  Made the object mortal again at the end.


Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.113.4.21
retrieving revision 1.113.4.22
diff -C2 -d -r1.113.4.21 -r1.113.4.22
*** test_descr.py	11 Jul 2002 07:11:13 -0000	1.113.4.21
--- test_descr.py	11 Jul 2002 18:30:02 -0000	1.113.4.22
***************
*** 2983,2986 ****
--- 2983,2987 ----
  
  def subtype_resurrection():
+     import gc
      if verbose:
          print "Testing resurrection of new-style instance..."
***************
*** 2995,3003 ****
      c = C()
      c.attr = 42
!     # The only interesting thing here is whether this blows up, due to flawed
      #  GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug).
      del c
!     del C.container[-1]  # resurrect it again for the heck of it
      vereq(C.container[-1].attr, 42)
  
  def test_main():
--- 2996,3014 ----
      c = C()
      c.attr = 42
!     # The most interesting thing here is whether this blows up, due to flawed
      #  GC tracking logic in typeobject.c's call_finalizer() (a 2.2.1 bug).
      del c
! 
!     # If that didn't blow up, it's also interesting to see whether clearing
!     # the last container slot works:  that will attempt to delete c again,
!     # which will cause c to get appended back to the container again "during"
!     # the del.
!     del C.container[-1]
!     vereq(len(C.container), 1)
      vereq(C.container[-1].attr, 42)
+ 
+     # Make c mortal again, so that the test framework with -l doesn't report
+     # it as a leak.
+     del C.__del__
  
  def test_main():