Skip to content

Commit 2c2a124

Browse files
committed
Fix SIGSEV when running "a"()
rt_call_function_n_kw did check for integers but not for strings being called. Added a check so running "a"() won't SIGSEV but throw an exception.
1 parent 7ee8e46 commit 2c2a124

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

py/runtime.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,8 @@ mp_obj_t rt_call_function_n_kw(mp_obj_t fun_in, uint n_args, uint n_kw, const mp
739739

740740
if (MP_OBJ_IS_SMALL_INT(fun_in)) {
741741
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "'int' object is not callable"));
742+
} else if(MP_OBJ_IS_STR(fun_in)) {
743+
nlr_jump(mp_obj_new_exception_msg(MP_QSTR_TypeError, "'str' object is not callable"));
742744
} else {
743745
mp_obj_base_t *fun = fun_in;
744746
if (fun->type->call != NULL) {

0 commit comments

Comments
 (0)