From 7f1c98177bb27a45886fd7e42aa72bef9b1e4a0f Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 28 Mar 2015 01:14:45 +0200 Subject: 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. --- py/mpconfig.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'py/mpconfig.h') diff --git a/py/mpconfig.h b/py/mpconfig.h index 94e2737de..d561f8079 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -125,11 +125,19 @@ #define MICROPY_QSTR_BYTES_IN_LEN (1) #endif -// Avoid using C stack when making Python function calls. +// Avoid using C stack when making Python function calls. C stack still +// may be used if there's no free heap. #ifndef MICROPY_STACKLESS #define MICROPY_STACKLESS (0) #endif +// Never use C stack when making Python function calls. This may break +// testsuite as will subtly change which exception is thrown in case +// of too deep recursion and other similar cases. +#ifndef MICROPY_STACKLESS_STRICT +#define MICROPY_STACKLESS_STRICT (0) +#endif + /*****************************************************************************/ /* Micro Python emitters */ -- cgit v1.2.3