Should not merge objects with same type name into one statistics entry in typestats
Bug #1183768 reported by
Kevin Xiao
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
objgraph |
Fix Committed
|
Undecided
|
Unassigned |
Bug Description
Classes in different may have same class name, like
module.a.A
module.b.A
But `typestats` merges these objects into one entry key `"A"`, making the result of `show_growth` confusing.
I think it's better to use the full qualified name of a class as key is better,
{
"module.a.A": 12,
"module.b.A": 3
}
To post a comment you must log in.
I ran into this as well. I modified my copy of objgraph to always use a small utility function to build the dotted name for a type:
def _typename(o):
t = type(o)
m = getattr(t, '__module__' '')
if m:
return '%s.%s' % (m, t.__name__)
else:
return t.__name__
And modified all code using type(o).__name__ to use _typename(o) instead.