mirror of
https://github.com/python/cpython.git
synced 2026-01-06 07:22:09 +00:00
Merge 3.5 (issue #26347)
This commit is contained in:
commit
06495ffe93
2 changed files with 7 additions and 2 deletions
|
|
@ -2571,8 +2571,6 @@ def apply_defaults(self):
|
|||
empty dict.
|
||||
"""
|
||||
arguments = self.arguments
|
||||
if not arguments:
|
||||
return
|
||||
new_arguments = []
|
||||
for name, param in self._signature.parameters.items():
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -3325,6 +3325,13 @@ def foo(): pass
|
|||
ba.apply_defaults()
|
||||
self.assertEqual(list(ba.arguments.items()), [])
|
||||
|
||||
# Make sure a no-args binding still acquires proper defaults.
|
||||
def foo(a='spam'): pass
|
||||
sig = inspect.signature(foo)
|
||||
ba = sig.bind()
|
||||
ba.apply_defaults()
|
||||
self.assertEqual(list(ba.arguments.items()), [('a', 'spam')])
|
||||
|
||||
|
||||
class TestSignaturePrivateHelpers(unittest.TestCase):
|
||||
def test_signature_get_bound_param(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue