Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions py/mpconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,11 @@ typedef double mp_float_t;
#define MICROPY_PY_SYS_TRACEBACKLIMIT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EVERYTHING)
#endif

// Whether to disable traceback allocation
#ifndef MICROPY_PY_SYS_TRACEBACK_DISABLE
#define MICROPY_PY_SYS_TRACEBACK_DISABLE 0
#endif

// Whether the sys module supports attribute delegation
// This is enabled automatically when needed by other features
#ifndef MICROPY_PY_SYS_ATTR_DELEGATION
Expand Down
4 changes: 4 additions & 0 deletions py/obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,11 @@ bool mp_obj_is_exception_type(mp_obj_t self_in);
bool mp_obj_is_exception_instance(mp_obj_t self_in);
bool mp_obj_exception_match(mp_obj_t exc, mp_const_obj_t exc_type);
void mp_obj_exception_clear_traceback(mp_obj_t self_in);
#if MICROPY_PY_SYS_TRACEBACK_DISABLE
static inline void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {}
#else
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block);
#endif
void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values);
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in);
mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args);
Expand Down
2 changes: 2 additions & 0 deletions py/objexcept.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) {
self->traceback_data = NULL;
}

#if !MICROPY_PY_SYS_TRACEBACK_DISABLE
void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) {
mp_obj_exception_t *self = get_native_exception(self_in);

Expand Down Expand Up @@ -631,6 +632,7 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
tb_data[1] = line;
tb_data[2] = block;
}
#endif // !MICROPY_PY_SYS_TRACEBACK_DISABLE

void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values) {
mp_obj_exception_t *self = get_native_exception(self_in);
Expand Down
Loading