File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2591,8 +2591,6 @@ def apply_defaults(self):
25912591 empty dict.
25922592 """
25932593 arguments = self .arguments
2594- if not arguments :
2595- return
25962594 new_arguments = []
25972595 for name , param in self ._signature .parameters .items ():
25982596 try :
Original file line number Diff line number Diff line change @@ -3324,6 +3324,13 @@ def foo(): pass
33243324 ba .apply_defaults ()
33253325 self .assertEqual (list (ba .arguments .items ()), [])
33263326
3327+ # Make sure a no-args binding still acquires proper defaults.
3328+ def foo (a = 'spam' ): pass
3329+ sig = inspect .signature (foo )
3330+ ba = sig .bind ()
3331+ ba .apply_defaults ()
3332+ self .assertEqual (list (ba .arguments .items ()), [('a' , 'spam' )])
3333+
33273334
33283335class TestSignaturePrivateHelpers (unittest .TestCase ):
33293336 def test_signature_get_bound_param (self ):
You can’t perform that action at this time.
0 commit comments