Issue #18830: inspect.getclasstree() no more produces duplicated entries even

when input list contains duplicates.
This commit is contained in:
Serhiy Storchaka 2013-09-05 17:14:32 +03:00
parent e1040e276b
commit 362c1b513d
4 changed files with 26 additions and 3 deletions

View file

@ -753,7 +753,8 @@ def getclasstree(classes, unique=False):
for parent in c.__bases__:
if not parent in children:
children[parent] = []
children[parent].append(c)
if c not in children[parent]:
children[parent].append(c)
if unique and parent in classes: break
elif c not in roots:
roots.append(c)