diff -r 340f45374cf5 Lib/inspect.py --- a/Lib/inspect.py Thu Aug 29 12:37:28 2013 +0300 +++ b/Lib/inspect.py Thu Aug 29 13:04:36 2013 +0300 @@ -789,7 +789,8 @@ 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) diff -r 340f45374cf5 Lib/test/inspect_fodder.py --- a/Lib/test/inspect_fodder.py Thu Aug 29 12:37:28 2013 +0300 +++ b/Lib/test/inspect_fodder.py Thu Aug 29 13:04:36 2013 +0300 @@ -49,6 +49,8 @@ class MalodorousPervert(StupidGit): pass +Tit = MalodorousPervert + class ParrotDroppings: pass diff -r 340f45374cf5 Lib/test/test_inspect.py --- a/Lib/test/test_inspect.py Thu Aug 29 12:37:28 2013 +0300 +++ b/Lib/test/test_inspect.py Thu Aug 29 13:04:36 2013 +0300 @@ -225,8 +225,25 @@ [('FesteringGob', mod.FesteringGob), ('MalodorousPervert', mod.MalodorousPervert), ('ParrotDroppings', mod.ParrotDroppings), - ('StupidGit', mod.StupidGit)]) - tree = inspect.getclasstree([cls[1] for cls in classes], 1) + ('StupidGit', mod.StupidGit), + ('Tit', mod.MalodorousPervert), + ]) + tree = inspect.getclasstree([cls[1] for cls in classes]) + self.assertEqual(tree, + [(object, ()), + [(mod.ParrotDroppings, (object,)), + [(mod.FesteringGob, (mod.MalodorousPervert, + mod.ParrotDroppings)) + ], + (mod.StupidGit, (object,)), + [(mod.MalodorousPervert, (mod.StupidGit,)), + [(mod.FesteringGob, (mod.MalodorousPervert, + mod.ParrotDroppings)) + ] + ] + ] + ]) + tree = inspect.getclasstree([cls[1] for cls in classes], True) self.assertEqual(tree, [(object, ()), [(mod.ParrotDroppings, (object,)),