_gcdebug.py
changeset 10589 7c23b7de2b8d
parent 10331 6f25c7e4f19b
equal deleted inserted replaced
10588:fdaa0e4b7eaf 10589:7c23b7de2b8d
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    13 # FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
    14 # details.
    14 # details.
    15 #
    15 #
    16 # You should have received a copy of the GNU Lesser General Public License along
    16 # You should have received a copy of the GNU Lesser General Public License along
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    17 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
       
    18 from __future__ import print_function
    18 
    19 
    19 import gc, types, weakref
    20 import gc, types, weakref
    20 
    21 
    21 from cubicweb.schema import CubicWebRelationSchema, CubicWebEntitySchema
    22 from cubicweb.schema import CubicWebRelationSchema, CubicWebEntitySchema
    22 try:
    23 try:
    66             try:
    67             try:
    67                 ocounters[key] += 1
    68                 ocounters[key] += 1
    68             except KeyError:
    69             except KeyError:
    69                 ocounters[key] = 1
    70                 ocounters[key] = 1
    70         if isinstance(obj, viewreferrersclasses):
    71         if isinstance(obj, viewreferrersclasses):
    71             print '   ', obj, referrers(obj, showobjs, maxlevel)
    72             print('   ', obj, referrers(obj, showobjs, maxlevel))
    72     garbage = [repr(obj) for obj in gc.garbage]
    73     garbage = [repr(obj) for obj in gc.garbage]
    73     return counters, ocounters, garbage
    74     return counters, ocounters, garbage
    74 
    75 
    75 
    76 
    76 def referrers(obj, showobj=False, maxlevel=1):
    77 def referrers(obj, showobj=False, maxlevel=1):