Skip to content

Commit cbd9ae5

Browse files
committed
py/compile: Don't unnecessarily save state when compiling param list.
Parameter lists can't be nested so there is no need to save the global state when compiling them.
1 parent e4404fb commit cbd9ae5

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

py/compile.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -663,11 +663,6 @@ STATIC qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns
663663
pns->nodes[4] = (mp_parse_node_t)s;
664664
}
665665

666-
// save variables (probably don't need to do this, since we can't have nested definitions..?)
667-
uint old_have_star = comp->have_star;
668-
uint old_num_dict_params = comp->num_dict_params;
669-
uint old_num_default_params = comp->num_default_params;
670-
671666
// compile default parameters
672667
comp->have_star = false;
673668
comp->num_dict_params = 0;
@@ -691,11 +686,6 @@ STATIC qstr compile_funcdef_helper(compiler_t *comp, mp_parse_node_struct_t *pns
691686
// make the function
692687
close_over_variables_etc(comp, fscope, comp->num_default_params, comp->num_dict_params);
693688

694-
// restore variables
695-
comp->have_star = old_have_star;
696-
comp->num_dict_params = old_num_dict_params;
697-
comp->num_default_params = old_num_default_params;
698-
699689
// return its name (the 'f' in "def f(...):")
700690
return fscope->simple_name;
701691
}

0 commit comments

Comments
 (0)