Skip to content

Commit

Permalink
Merge pull request #22 from embray/fix-by-type-cycle
Browse files Browse the repository at this point in the history
Fix reference cycle that can result from objgraph.by_type
  • Loading branch information
mgedmin committed Jul 28, 2015
2 parents 16aaf1c + deb6cd7 commit 0311889
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions objgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,12 @@ def by_type(typename, objects=None):
if objects is None:
objects = gc.get_objects()
if '.' in typename:
return [o for o in objects if _long_typename(o) == typename]
ret = [o for o in objects if _long_typename(o) == typename]
else:
return [o for o in objects if _short_typename(o) == typename]
ret = [o for o in objects if _short_typename(o) == typename]

del objects
return ret


def at(addr):
Expand Down

0 comments on commit 0311889

Please sign in to comment.