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
8a387219
Commit
8a387219
authored
Mar 06, 2018
by
Yury Selivanov
Committed by
GitHub
Mar 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-33009: Fix inspect.signature() for single-parameter partialmethods. (GH-6004)
parent
5d926471
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
1 deletion
+13
-1
Lib/inspect.py
Lib/inspect.py
+2
-1
Lib/test/test_inspect.py
Lib/test/test_inspect.py
+10
-0
Misc/NEWS.d/next/Library/2018-03-06-11-54-59.bpo-33009.-Ekysb.rst
...S.d/next/Library/2018-03-06-11-54-59.bpo-33009.-Ekysb.rst
+1
-0
No files found.
Lib/inspect.py
View file @
8a387219
...
...
@@ -2254,7 +2254,8 @@ def _signature_from_callable(obj, *,
return
sig
else
:
sig_params
=
tuple
(
sig
.
parameters
.
values
())
assert
first_wrapped_param
is
not
sig_params
[
0
]
assert
(
not
sig_params
or
first_wrapped_param
is
not
sig_params
[
0
])
new_params
=
(
first_wrapped_param
,)
+
sig_params
return
sig
.
replace
(
parameters
=
new_params
)
...
...
Lib/test/test_inspect.py
View file @
8a387219
...
...
@@ -2580,6 +2580,16 @@ class TestSignatureObject(unittest.TestCase):
(
'c'
,
1
,
...,
'keyword_only'
)),
'spam'
))
class
Spam
:
def
test
(
self
:
'anno'
,
x
):
pass
g
=
partialmethod
(
test
,
1
)
self
.
assertEqual
(
self
.
signature
(
Spam
.
g
),
(((
'self'
,
...,
'anno'
,
'positional_or_keyword'
),),
...))
def
test_signature_on_fake_partialmethod
(
self
):
def
foo
(
a
):
pass
foo
.
_partialmethod
=
'spam'
...
...
Misc/NEWS.d/next/Library/2018-03-06-11-54-59.bpo-33009.-Ekysb.rst
0 → 100644
View file @
8a387219
Fix inspect.signature() for single-parameter partialmethods.
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