[Python-checkins] python/nondist/sandbox/setobj setobject.c, 1.14, 1.15 test_set.py, 1.13, 1.14

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Nov 15 08:46:42 EST 2003


Update of /cvsroot/python/python/nondist/sandbox/setobj
In directory sc8-pr-cvs1:/tmp/cvs-serv29637

Modified Files:
	setobject.c test_set.py 
Log Message:
Add code to test ref counting.

Index: setobject.c
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setobj/setobject.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** setobject.c	14 Nov 2003 23:20:19 -0000	1.14
--- setobject.c	15 Nov 2003 13:46:39 -0000	1.15
***************
*** 602,606 ****
  
  static long
! frozenset_hash(PyObject *so)
  {
  	PyObject *it, *item;
--- 602,606 ----
  
  static long
! frozenset_hash(setobject *so)
  {
  	PyObject *it, *item;

Index: test_set.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setobj/test_set.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** test_set.py	14 Nov 2003 22:59:28 -0000	1.13
--- test_set.py	15 Nov 2003 13:46:39 -0000	1.14
***************
*** 229,237 ****
  
  def test_main(verbose=None):
      from test import test_sets
!     test_support.run_unittest(
          TestSet,
          TestFrozenSet,
          )
  
  if __name__ == "__main__":
--- 229,250 ----
  
  def test_main(verbose=None):
+     import sys
      from test import test_sets
!     test_classes = (
          TestSet,
          TestFrozenSet,
          )
+ 
+     test_support.run_unittest(*test_classes)
+ 
+     # verify reference counting
+     if verbose and hasattr(sys, "gettotalrefcount"):
+         import gc
+         counts = [None] * 5
+         for i in xrange(len(counts)):
+             test_support.run_unittest(*test_classes)
+             gc.collect()
+             counts[i] = sys.gettotalrefcount()
+         print counts
  
  if __name__ == "__main__":





More information about the Python-checkins mailing list