in dict displays, evaluate the key before the value (closes #11205)

Patch partially by Steve Dougherty.
This commit is contained in:
Benjamin Peterson 2015-05-28 14:30:26 -05:00
parent 44e625860b
commit ee85339cc6
6 changed files with 127 additions and 113 deletions

View file

@ -3138,8 +3138,8 @@ compiler_dict(struct compiler *c, expr_ty e)
containers++;
}
else {
VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i));
VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.keys, i));
VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i));
elements++;
}
}
@ -3287,8 +3287,8 @@ compiler_call_helper(struct compiler *c,
}
else if (nsubkwargs) {
/* A keyword argument and we already have a dict. */
VISIT(c, expr, kw->value);
ADDOP_O(c, LOAD_CONST, kw->arg, consts);
VISIT(c, expr, kw->value);
nseen++;
}
else {