Message198806
A pair of inconsistencies I've found using Signature.bind:
(<a>=0).bind() -*> TypeError
Letting the default value of a positional-only parameter be used raises a TypeError with message that 'a' was passed by name.
(a, *args).bind(a=0, args=1) -> BoundArguments({'a': 0, 'args': 1})
Should positional arguments not be enough for bind() to reach the parameter before *args, bind() will process the *args parameter while looking for named arguments, and eventually bind the *args parameter to any named argument for it, instead of leaving that named argument for **kwargs or erroring out.
I've attached a patch that tests and fixes both issues.
I've taken the liberty of extending test_inspect.TestSignatureBind.test_signature_bind_positional_only as it already did all the setup needed but overlooked to check the condition where a defaulted positional-only parameter is left out. |
|
Date |
User |
Action |
Args |
2013-10-01 20:50:06 | epsy | set | recipients:
+ epsy |
2013-10-01 20:50:06 | epsy | set | messageid: <1380660606.62.0.855384003289.issue19140@psf.upfronthosting.co.za> |
2013-10-01 20:50:06 | epsy | link | issue19140 messages |
2013-10-01 20:50:06 | epsy | create | |
|