mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 20:20:14 +01:00
mp_obj_print_exception(): Assert that traceback has sane number of entries.
This commit is contained in:
1
py/obj.c
1
py/obj.c
@@ -52,6 +52,7 @@ void mp_obj_print_exception(mp_obj_t exc) {
|
||||
machine_uint_t n, *values;
|
||||
mp_obj_exception_get_traceback(exc, &n, &values);
|
||||
if (n > 0) {
|
||||
assert(n % 3 == 0);
|
||||
printf("Traceback (most recent call last):\n");
|
||||
for (int i = n - 3; i >= 0; i -= 3) {
|
||||
#if MICROPY_ENABLE_SOURCE_LINE
|
||||
|
||||
Reference in New Issue
Block a user