Skip to content

Commit e8432b3

Browse files
committed
stackctrl: Encode "recursion depth exceeded" message as qstr.
So corresponding exception can be thrown even under tight memory conditions.
1 parent fa3b895 commit e8432b3

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

py/qstrdefs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ Q(qstr_info)
385385
#if MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF && (MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE == 0)
386386
Q(alloc_emergency_exception_buf)
387387
#endif
388+
Q(maximum recursion depth exceeded)
388389

389390
Q(<module>)
390391
Q(<lambda>)

py/stackctrl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void mp_stack_set_limit(mp_uint_t limit) {
4848

4949
void mp_stack_check(void) {
5050
if (mp_stack_usage() >= MP_STATE_VM(stack_limit)) {
51-
nlr_raise(mp_obj_new_exception_msg(&mp_type_RuntimeError, "maximum recursion depth exceeded"));
51+
nlr_raise(mp_obj_new_exception_arg1(&mp_type_RuntimeError,
52+
MP_OBJ_NEW_QSTR(MP_QSTR_maximum_space_recursion_space_depth_space_exceeded)));
5253
}
5354
}
5455

0 commit comments

Comments
 (0)