Generates invalid code for functions with named vararg and unnamed kwargs

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

Bug Description

foo(*args, a=1, b=2) isn't legal syntax until Python 2.6, but that's the code Pythoscope can generate in the case vararg has been assigned a name and kwarg hasn't.

Doctest for pythoscope.generator.call_as_string that reproduces the issue:

   Generates valid code when vararg has been named and kwarg wasn't.
       >>> args = serialize((1, 2, 3))
       >>> call_as_string('wrap', {'args': args, 'kwargs': serialize({'a': 6, 'b': 7})},
       ... Function('wrap', ['*args', '**kwargs']), {args: 'atuple'})
       'wrap(a=6, b=7, *atuple)'

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

Fixed in trunk r322.

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.