diff options
Diffstat (limited to 'py/stackctrl.c')
-rw-r--r-- | py/stackctrl.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/py/stackctrl.c b/py/stackctrl.c index 7d7bbc1be1..4c51653727 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -27,6 +27,7 @@ #include "py/mpstate.h" #include "py/nlr.h" #include "py/obj.h" +#include "py/runtime.h" #include "py/stackctrl.h" void mp_stack_ctrl_init(void) { @@ -46,10 +47,14 @@ void mp_stack_set_limit(mp_uint_t limit) { MP_STATE_VM(stack_limit) = limit; } +void mp_exc_recursion_depth(void) { + nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError, + MP_OBJ_NEW_QSTR(MP_QSTR_maximum_space_recursion_space_depth_space_exceeded))); +} + void mp_stack_check(void) { if (mp_stack_usage() >= MP_STATE_VM(stack_limit)) { - nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError, - MP_OBJ_NEW_QSTR(MP_QSTR_maximum_space_recursion_space_depth_space_exceeded))); + mp_exc_recursion_depth(); } } |