summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-02-10 09:29:59 -0500
committerBenjamin Peterson <benjamin@python.org>2013-02-10 09:29:59 -0500
commit1ef876cd28aa2f76edffb6e4d209c6a49b5705ef (patch)
treeeeb6cbf3329f73d4ddce50aef3c912b9e4aef400 /Python/compile.c
parent34a2a87d17ff1730946adf86d23a4737271e53b3 (diff)
downloadcpython-git-1ef876cd28aa2f76edffb6e4d209c6a49b5705ef.tar.gz
evaluate positional defaults before keyword-only defaults (closes #16967)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 8f876a6d0d..a0df40c323 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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;