Skip to content

Commit 64dd8a9

Browse files
committed
gh-162668: check positional only binding before applying defaults
1 parent aa4a1aa commit 64dd8a9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎Lib/test/test_inspect/test_inspect.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6032,9 +6032,15 @@ def f(x=0, y=1, /, **options):
60326032
return x, y, options
60336033

60346034
bound = inspect.signature(f).bind(y=2)
6035+
self.assertEqual(bound.args, ())
6036+
self.assertEqual(bound.kwargs, {'y': 2})
60356037
bound.apply_defaults()
60366038
self.assertEqual(f(*bound.args, **bound.kwargs), f(y=2))
60376039

6040+
bound = inspect.signature(f).bind(3, 4, y=5)
6041+
self.assertEqual(bound.args, (3, 4))
6042+
self.assertEqual(bound.kwargs, {'y': 5})
6043+
60386044
def g(x=0, y=1, /):
60396045
pass
60406046

0 commit comments

Comments
 (0)