diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-03-28 01:14:45 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2015-04-03 00:26:47 +0300 |
commit | 7f1c98177bb27a45886fd7e42aa72bef9b1e4a0f (patch) | |
tree | 915706975a238a9944cdc45f4bd944bd201580bd /py/vm.c | |
parent | f0a8f2119066943553ba2dc1f27a402ad5ef0a7b (diff) |
vm: Support strict stackless mode, with proper exception reporting.
I.e. in this mode, C stack will never be used to call a Python function,
but if there's no free heap for a call, it will be reported as
RuntimeError (as expected), not MemoryError.
Diffstat (limited to 'py/vm.c')
-rw-r--r-- | py/vm.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -880,6 +880,12 @@ unwind_jump:; nlr_pop(); goto run_code_state; } + #if MICROPY_STACKLESS_STRICT + else { + deep_recursion_error: + mp_exc_recursion_depth(); + } + #endif } #endif SET_TOP(mp_call_function_n_kw(*sp, unum & 0xff, (unum >> 8) & 0xff, sp + 1)); @@ -912,6 +918,11 @@ unwind_jump:; nlr_pop(); goto run_code_state; } + #if MICROPY_STACKLESS_STRICT + else { + goto deep_recursion_error; + } + #endif } #endif SET_TOP(mp_call_method_n_kw_var(false, unum, sp)); @@ -941,6 +952,11 @@ unwind_jump:; nlr_pop(); goto run_code_state; } + #if MICROPY_STACKLESS_STRICT + else { + goto deep_recursion_error; + } + #endif } #endif SET_TOP(mp_call_method_n_kw(unum & 0xff, (unum >> 8) & 0xff, sp)); @@ -973,6 +989,11 @@ unwind_jump:; nlr_pop(); goto run_code_state; } + #if MICROPY_STACKLESS_STRICT + else { + goto deep_recursion_error; + } + #endif } #endif SET_TOP(mp_call_method_n_kw_var(true, unum, sp)); |