Antoine Pitrou <pit...@free.fr> added the comment: This new patch also adds a function named gc.is_tracked() which returns True if the object is tracked by the GC:
>>> import gc >>> gc.is_tracked(1) False >>> gc.is_tracked([]) True >>> gc.is_tracked(()) True >>> gc.is_tracked((0,1)) False >>> gc.is_tracked((0,"a")) False >>> gc.is_tracked((0,[])) True >>> gc.is_tracked((0,(1,2))) False >>> gc.is_tracked((0,(1,0.55))) False >>> gc.is_tracked((0,(1,{}))) True >>> gc.is_tracked((None, True, False, "a", (1,2,u"z",("another", "nested", u"tuple")), int)) False >>> gc.is_tracked(gc) True (as you see the empty tuple is considered tracked, this is not important since it is a singleton anyway) Added file: http://bugs.python.org/file12379/gctrigger3.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4074> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com