py/runtime: Move mp_exc_recursion_depth to runtime and rename to raise.
For consistency this helper function is renamed to match the other
exception helpers, and moved to their location in runtime.c.
diff --git a/py/runtime.c b/py/runtime.c
index 457266c..5fd053e 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1456,3 +1456,10 @@
NORETURN void mp_raise_NotImplementedError(const char *msg) {
mp_raise_msg(&mp_type_NotImplementedError, msg);
}
+
+#if MICROPY_STACK_CHECK
+NORETURN void mp_raise_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)));
+}
+#endif
diff --git a/py/runtime.h b/py/runtime.h
index 3f0d110..a19f64c 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -151,7 +151,7 @@
NORETURN void mp_raise_TypeError(const char *msg);
NORETURN void mp_raise_NotImplementedError(const char *msg);
NORETURN void mp_raise_OSError(int errno_);
-NORETURN void mp_exc_recursion_depth(void);
+NORETURN void mp_raise_recursion_depth(void);
#if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG
#undef mp_check_self
diff --git a/py/stackctrl.c b/py/stackctrl.c
index 11165b9..5c07796 100644
--- a/py/stackctrl.c
+++ b/py/stackctrl.c
@@ -48,14 +48,9 @@
MP_STATE_THREAD(stack_limit) = limit;
}
-NORETURN 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_THREAD(stack_limit)) {
- mp_exc_recursion_depth();
+ mp_raise_recursion_depth();
}
}
diff --git a/py/vm.c b/py/vm.c
index e667972..5011af5 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -935,7 +935,7 @@
#if MICROPY_STACKLESS_STRICT
else {
deep_recursion_error:
- mp_exc_recursion_depth();
+ mp_raise_recursion_depth();
}
#else
// If we couldn't allocate codestate on heap, in