[services] Fix 'repo_gc_stats' to return a list of unreachable objects' repr
authorRémi Cardona <remi.cardona@logilab.fr>
Tue, 10 Feb 2015 14:37:51 +0100
changeset 10310 b49761555ad6
parent 10309 35bf741203d6
child 10311 4e9dcca71fad
[services] Fix 'repo_gc_stats' to return a list of unreachable objects' repr
_gcdebug.py
sobjects/services.py
--- a/_gcdebug.py	Tue Feb 10 12:18:38 2015 +0100
+++ b/_gcdebug.py	Tue Feb 10 14:37:51 2015 +0100
@@ -63,7 +63,8 @@
                 ocounters[key] = 1
         if isinstance(obj, viewreferrersclasses):
             print '   ', obj, referrers(obj, showobjs, maxlevel)
-    return counters, ocounters, gc.garbage
+    garbage = [repr(obj) for obj in gc.garbage]
+    return counters, ocounters, garbage
 
 
 def referrers(obj, showobj=False, maxlevel=1):
--- a/sobjects/services.py	Tue Feb 10 12:18:38 2015 +0100
+++ b/sobjects/services.py	Tue Feb 10 14:37:51 2015 +0100
@@ -100,7 +100,7 @@
         results['lookupclasses'] = values
         values = sorted(ocounters.iteritems(), key=lambda x: x[1], reverse=True)[:nmax]
         results['referenced'] = values
-        results['unreachable'] = len(garbage)
+        results['unreachable'] = garbage
         return results