diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-25 23:45:52 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-25 23:45:52 +0100 |
commit | c492cf1f442653019b287bf0e8bd0c43f2abd837 (patch) | |
tree | 080ca4ed09ce63c6edd3cfc8bf0c6e8298588eb6 /py/runtime.c | |
parent | daab651c5ca0d7198f6db2fa0abe2399fc08c69e (diff) | |
parent | 755565d2cbc7c7f7abe6f457012b49ddf6b23ca1 (diff) | |
download | micropython-c492cf1f442653019b287bf0e8bd0c43f2abd837.tar.gz micropython-c492cf1f442653019b287bf0e8bd0c43f2abd837.zip |
Merge branch 'master' of github.com:micropython/micropython
Diffstat (limited to 'py/runtime.c')
-rw-r--r-- | py/runtime.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/py/runtime.c b/py/runtime.c index 30db01cd53..b56740a022 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -481,10 +481,13 @@ 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) { - return type->call(fun_in, n_args, n_kw, args); - } else { - nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not callable", mp_obj_get_type_str(fun_in))); + mp_obj_t res = type->call(fun_in, n_args, n_kw, args); + if (res != NULL) { + return res; + } } + + nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "'%s' object is not callable", mp_obj_get_type_str(fun_in))); } // args contains: fun self/NULL arg(0) ... arg(n_args-2) arg(n_args-1) kw_key(0) kw_val(0) ... kw_key(n_kw-1) kw_val(n_kw-1) |