diff Python/compile.c @ 82133:d296cf1600a8

evaluate positional defaults before keyword-only defaults (closes #16967)
author Benjamin Peterson <benjamin@python.org>
date Sun, 10 Feb 2013 09:29:59 -0500
parents 0238cc842805
children 6917402c6191
line wrap: on
line diff
--- a/Python/compile.c	Sun Feb 10 14:44:43 2013 +0200
+++ b/Python/compile.c	Sun Feb 10 09:29:59 2013 -0500
@@ -1565,6 +1565,8 @@
 
     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 @@
             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;