summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
Diffstat (limited to 'py')
-rw-r--r--py/pystack.c3
-rw-r--r--py/qstrdefs.h4
2 files changed, 6 insertions, 1 deletions
diff --git a/py/pystack.c b/py/pystack.c
index 767c307e9..552e59d53 100644
--- a/py/pystack.c
+++ b/py/pystack.c
@@ -43,7 +43,8 @@ void *mp_pystack_alloc(size_t n_bytes) {
#endif
if (MP_STATE_THREAD(pystack_cur) + n_bytes > MP_STATE_THREAD(pystack_end)) {
// out of memory in the pystack
- mp_raise_recursion_depth();
+ nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError,
+ MP_OBJ_NEW_QSTR(MP_QSTR_pystack_space_exhausted)));
}
void *ptr = MP_STATE_THREAD(pystack_cur);
MP_STATE_THREAD(pystack_cur) += n_bytes;
diff --git a/py/qstrdefs.h b/py/qstrdefs.h
index 1b480c9c7..a60905812 100644
--- a/py/qstrdefs.h
+++ b/py/qstrdefs.h
@@ -52,3 +52,7 @@ Q(<genexpr>)
Q(<string>)
Q(<stdin>)
Q(utf-8)
+
+#if MICROPY_ENABLE_PYSTACK
+Q(pystack exhausted)
+#endif