py: Allow tail call optimisation in mp_call_function_n_kw.

This saves 4 words of stack space per Python call.
This commit is contained in:
Damien George
2014-06-03 13:40:16 +01:00
parent 65ec33200a
commit 3f52262465
2 changed files with 2 additions and 5 deletions

View File

@@ -526,10 +526,7 @@ mp_obj_t mp_call_function_n_kw(mp_obj_t fun_in, uint n_args, uint n_kw, const mp
// do the call
if (type->call != NULL) {
mp_obj_t res = type->call(fun_in, n_args, n_kw, args);
if (res != NULL) {
return res;
}
return type->call(fun_in, n_args, n_kw, args);
}
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not callable", mp_obj_get_type_str(fun_in)));