Message193757
If you are the same 'ariel' as on SO, thank you for the detective work and the informative report here. Without it this 2.7-only bug would be low priority and might have sat open until we stopped patching 2.7.
The underlying issue is that a) 2.x had the 'feature' of allowing tuples of parameter names to signal automatic unpacking of tuples of arguments, and b) the unnamed tuple got a pseudoname of the form '.n' in the list of argument names, which calltips uses.
>>> def f((a,b), (c,d)): pass
>>> f.func_code.co_varnames
('.0', '.1', 'a', 'b', 'c', 'd')
Issue #791968 added the following line to change '.n' to '<tuple>'.
arg_text = "(%s)" % re.sub("\.\d+", "<tuple>", arg_text)
But this also changes float strings of form 'm.n' to 'm<tuple>'. The solution is to recognize the difference between the absence and presence of a preceding digit and not do the substitution in the latter case. Adding the negative lookbehind assertion (?<![0-9]) makes
def f((a,b), c=0.0):
produce (<tuple>, c=0.0). I am preparing a patch, including the test. |
|
Date |
User |
Action |
Args |
2013-07-26 22:10:30 | terry.reedy | set | recipients:
+ terry.reedy, ariel_bruner |
2013-07-26 22:10:30 | terry.reedy | set | messageid: <1374876630.69.0.338682752377.issue18539@psf.upfronthosting.co.za> |
2013-07-26 22:10:30 | terry.reedy | link | issue18539 messages |
2013-07-26 22:10:30 | terry.reedy | create | |
|