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
f229bc5c
Commit
f229bc5c
authored
May 15, 2015
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inspect: Remove "0x..." IDs from Signature objects' __repr__
Issue 24200.
parent
51b58325
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
Lib/inspect.py
Lib/inspect.py
+3
-6
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+1
-2
No files found.
Lib/inspect.py
View file @
f229bc5c
...
...
@@ -2346,8 +2346,7 @@ class Parameter:
return
formatted
def
__repr__
(
self
):
return
'<{} at {:#x} "{}">'
.
format
(
self
.
__class__
.
__name__
,
id
(
self
),
self
)
return
'<{} "{}">'
.
format
(
self
.
__class__
.
__name__
,
self
)
def
__hash__
(
self
):
return
hash
((
self
.
name
,
self
.
kind
,
self
.
annotation
,
self
.
default
))
...
...
@@ -2464,8 +2463,7 @@ class BoundArguments:
args
=
[]
for
arg
,
value
in
self
.
arguments
.
items
():
args
.
append
(
'{}={!r}'
.
format
(
arg
,
value
))
return
'<{} at {:#x} ({})>'
.
format
(
self
.
__class__
.
__name__
,
id
(
self
),
', '
.
join
(
args
))
return
'<{} ({})>'
.
format
(
self
.
__class__
.
__name__
,
', '
.
join
(
args
))
class
Signature
:
...
...
@@ -2835,8 +2833,7 @@ class Signature:
self
.
_return_annotation
=
state
[
'_return_annotation'
]
def
__repr__
(
self
):
return
'<{} at {:#x} "{}">'
.
format
(
self
.
__class__
.
__name__
,
id
(
self
),
self
)
return
'<{} {}>'
.
format
(
self
.
__class__
.
__name__
,
self
)
def
__str__
(
self
):
result
=
[]
...
...
Lib/test/test_inspect.py
View file @
f229bc5c
...
...
@@ -3153,8 +3153,7 @@ class TestBoundArguments(unittest.TestCase):
def
foo
(
a
,
b
,
*
,
c
:
1
=
{},
**
kw
)
->
{
42
:
'ham'
}:
pass
sig
=
inspect
.
signature
(
foo
)
ba
=
sig
.
bind
(
20
,
30
,
z
=
{})
self
.
assertRegex
(
repr
(
ba
),
r'<BoundArguments at 0x[a-fA-F0-9]+ \
(
a=20,.*\
}
\}\
)>
')
self
.
assertRegex
(
repr
(
ba
),
r'<BoundArguments \
(
a=20,.*\
}
\}\
)>
')
class TestSignaturePrivateHelpers(unittest.TestCase):
...
...
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