Can generate invalid code for functions with vararg

Bug #475409 reported by Michal Kwiatkowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Pythoscope
Fix Released
Medium
Michal Kwiatkowski

Bug Description

When varargs is present, all preceding arguments should be positioned, not named. Currently test generator will generate invalid code for a function like foo:

>> def foo(a, *args):
... pass
>>> foo(a=4, *(1, 2, 3))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: foo() got multiple values for keyword argument 'a'
>>> foo(a=4, 1, 2, 3)
SyntaxError: non-keyword arg after keyword arg

pythoscope.generator.call_as_string doesn't yet support sorting arguments by position, so a bit of rework is needed there.

Revision history for this message
Michal Kwiatkowski (ruby) wrote :

Fixed in trunk r323.

Changed in pythoscope:
assignee: nobody → Michal Kwiatkowski (ruby)
status: Confirmed → Fix Committed
Changed in pythoscope:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.