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

Jim Fulton cvs-admin at zope.org
Fri Nov 21 12:10:34 EST 2003


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

Modified Files:
	test.py 
Log Message:
When showing reference counts (-Lr), don't include an output line for
strs if the only object affected is the dummy key used internally by
the dictionary implementation.


=== Zope3/test.py 1.76 => 1.77 ===
--- Zope3/test.py:1.76	Thu Oct 30 03:15:30 2003
+++ Zope3/test.py	Fri Nov 21 12:10:33 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