[issue2292] Missing *-unpacking generalizations

Joshua Landau report at bugs.python.org
Tue Jan 20 17:28:03 CET 2015


Joshua Landau added the comment:

The problem seems to be that with the removal of

-        else if (TYPE(ch) == STAR) {
-            vararg = ast_for_expr(c, CHILD(n, i+1));
-            if (!vararg)
-                return NULL;
-            i++;
-        }
-        else if (TYPE(ch) == DOUBLESTAR) {
-            kwarg = ast_for_expr(c, CHILD(n, i+1));
-            if (!kwarg)
-                return NULL;
-            i++;
-        }

the code will ignore any subnodes that aren't of type "argument". However, the grammar still says

arglist: (argument ',')* (argument [','] | '*' test [',' '**' test] | '**' test)

so this is incorrect.

Here's an example of what you might get

inner(
    "a",            argument comma
    *"bcd",         star test comma
    "e",            argument comma
    f=6,            argument comma
    **{"g": 7},     doublestar test comma
    h=8,            argument comma
    **{"i":9}       doublestar test
)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2292>
_______________________________________


More information about the Python-bugs-list mailing list