diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-03-28 01:14:44 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-04-03 00:03:07 +0300 |
commit | 332a909d44382cbd9c0c08f70753e5310da0f693 (patch) | |
tree | dfab8ee142fbb3e8d618919ec83d233427569cef /py/objfun.c | |
parent | 2039757b854b656a41c9e041776ccd5dad8ec5fe (diff) | |
download | micropython-332a909d44382cbd9c0c08f70753e5310da0f693.tar.gz micropython-332a909d44382cbd9c0c08f70753e5310da0f693.zip |
vm: If there's no heap to call function in stackless manner, call via C stack.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/objfun.c b/py/objfun.c index 187bb5a59e..70b897b57d 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -161,7 +161,10 @@ mp_code_state *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, mp_uint_t n_arg // allocate state for locals and stack mp_uint_t state_size = n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t); mp_code_state *code_state; - code_state = m_new_obj_var(mp_code_state, byte, state_size); + code_state = m_new_obj_var_maybe(mp_code_state, byte, state_size); + if (!code_state) { + return NULL; + } code_state->n_state = n_state; code_state->ip = ip; |