commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7397 - trunk/gnue-common/src/apps


From: reinhard
Subject: [gnue] r7397 - trunk/gnue-common/src/apps
Date: Mon, 18 Apr 2005 08:35:19 -0500 (CDT)

Author: reinhard
Date: 2005-04-18 08:35:18 -0500 (Mon, 18 Apr 2005)
New Revision: 7397

Modified:
   trunk/gnue-common/src/apps/GBaseApp.py
Log:
First output all uncollectable objects, then output all cycles.


Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py      2005-04-18 13:19:53 UTC (rev 
7396)
+++ trunk/gnue-common/src/apps/GBaseApp.py      2005-04-18 13:35:18 UTC (rev 
7397)
@@ -858,22 +858,20 @@
         for item in gc.garbage:
           try:
             itemrep = "%s: %s" % (type (item), repr (item))
-            cycle   = self.findCycle (item, item)
-
           except:
             itemrep = "No representation available for object (weakref/proxy?)"
-            cycle   = None
 
           self.__gcLog (log, "%s" % itemrep)
 
+        for item in gc.garbage:
+          cycle = self.findCycle (item, item, None, [], {})
+
           if cycle:
-            self.__gcLog (log, "=" * 70)
+            self.__gcLog (log, "-" * 70)
 
             for line in self.analyzeCycle (cycle):
               self.__gcLog (log, line)
 
-            self.__gcLog (log, "=" * 70)
-
         self.__gcLog (log, "-" * 70)
 
       finally:
@@ -895,7 +893,7 @@
   # Find a reference cycle starting from a given object
   # ---------------------------------------------------------------------------
 
-  def findCycle (self, search, current, last = None, path = [], seen = {}):
+  def findCycle (self, search, current, last, path, seen):
     """
     Find a reference cycle starting from a given object (current) and ending
     with a given object (search). The result is either None if no such cycle
@@ -905,7 +903,7 @@
     following:
       'name'    name of the property within 'repr' holding the reference
       '[n]'     the reference is the n-th element of a sequence
-      '[name']  the reference is the value of key 'name' in a dictionary
+      '[name]'  the reference is the value of key 'name' in a dictionary
       '{}'      the reference is a key in a dictionary
 
     The latter three variants could be cumulative (i.e. [1][3]['foo']) and the
@@ -961,7 +959,7 @@
     # For dictionaries iterate over all items
     elif isinstance (current, types.DictType):
       for (key, element) in current.items ():
-        prop = (None, "[%s]" % key)
+        prop = (None, "[%s]" % repr (key))
 
         if element == search:
           return path + [prop]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]