This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author epsy
Recipients epsy
Date 2013-10-01.20:50:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380660606.62.0.855384003289.issue19140@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-10-01 20:50:06epsysetrecipients: + epsy
2013-10-01 20:50:06epsysetmessageid: <1380660606.62.0.855384003289.issue19140@psf.upfronthosting.co.za>
2013-10-01 20:50:06epsylinkissue19140 messages
2013-10-01 20:50:06epsycreate