[Zope3-checkins] CVS: Zope3 - test.py:1.75.6.1

Jim Fulton cvs-admin at zope.org
Thu Nov 6 07:35:09 EST 2003


Update of /cvs-repository/Zope3
In directory cvs.zope.org:/tmp/cvs-serv30339

Modified Files:
      Tag: adaptergeddon-branch
	test.py 
Log Message:
Imporved -Lr output:

Added some logic to avoid confusion in tracking reference count of a
  special string used as a dictionary dummy key.  This string causes
  random fluctuations in ref counts independent of memory leaks.

Added a heading row for the per-type reference count output.


=== Zope3/test.py 1.75 => 1.75.6.1 ===
--- Zope3/test.py:1.75	Mon Sep 22 18:37:22 2003
+++ Zope3/test.py	Thu Nov  6 07:35:08 2003
@@ -552,6 +552,10 @@
         type2all = {}
         for o in obs:
             all = sys.getrefcount(o)
+
+            if type(o) is str and o == '<dummy key>':
+                # avoid dictionary madness
+                continue
             t = type(o)
             if t in type2count:
                 type2count[t] += 1
@@ -566,8 +570,12 @@
               for t in type2count.iterkeys()]
         ct.sort()
         ct.reverse()
+        printed = False
         for delta1, delta2, t in ct:
             if delta1 or delta2:
+                if not printed:
+                    print "%-55s %8s %8s" % ('', 'insts', 'refs')
+                    printed = True
                 print "%-55s %8d %8d" % (t, delta1, delta2)
 
         self.type2count = type2count




More information about the Zope3-Checkins mailing list