evaluate positional defaults before keyword-only defaults (closes #16967)

This commit is contained in:
Benjamin Peterson 2013-02-10 09:29:59 -05:00
parent 34a2a87d17
commit 1ef876cd28
7 changed files with 161 additions and 147 deletions

View file

@ -1565,6 +1565,8 @@ compiler_function(struct compiler *c, stmt_ty s)
if (!compiler_decorators(c, decos))
return 0;
if (args->defaults)
VISIT_SEQ(c, expr, args->defaults);
if (args->kwonlyargs) {
int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs,
args->kw_defaults);
@ -1572,8 +1574,6 @@ compiler_function(struct compiler *c, stmt_ty s)
return 0;
kw_default_count = res;
}
if (args->defaults)
VISIT_SEQ(c, expr, args->defaults);
num_annotations = compiler_visit_annotations(c, args, returns);
if (num_annotations < 0)
return 0;