mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
when input list contains duplicates.
This commit is contained in:
commit
1e0d82cece
4 changed files with 26 additions and 3 deletions
|
@ -789,7 +789,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue