Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fb37c6a5
Commit
fb37c6a5
authored
Sep 05, 2013
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #18830: inspect.getclasstree() no more produces duplicated entries even
when input list contains duplicates.
parent
640bd844
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
Lib/inspect.py
Lib/inspect.py
+2
-1
Lib/test/inspect_fodder.py
Lib/test/inspect_fodder.py
+2
-0
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+19
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/inspect.py
View file @
fb37c6a5
...
...
@@ -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
)
...
...
Lib/test/inspect_fodder.py
View file @
fb37c6a5
...
...
@@ -49,6 +49,8 @@ class StupidGit:
class
MalodorousPervert
(
StupidGit
):
pass
Tit
=
MalodorousPervert
class
ParrotDroppings
:
pass
...
...
Lib/test/test_inspect.py
View file @
fb37c6a5
...
...
@@ -224,8 +224,25 @@ class TestRetrievingSourceCode(GetSourceBase):
[(
'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
,)),
...
...
Misc/NEWS
View file @
fb37c6a5
...
...
@@ -66,6 +66,9 @@ Core and Builtins
Library
-------
- Issue #18830: inspect.getclasstree() no more produces duplicated entries even
when input list contains duplicates.
- Issue #18909: Fix _tkinter.tkapp.interpaddr() on Windows 64-bit, don'
t
cast
64
-
bit
pointer
to
long
(
32
bits
).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment