Skip to content

Commit 1d76be2

Browse files
authored
Merge pull request #5574 from microDev1/traceback
Fix traceback object init
2 parents 6a8c82d + b5dd889 commit 1d76be2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ports/atmel-samd/boards/feather_m0_adalogger/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
99
INTERNAL_FLASH_FILESYSTEM = 1
1010
LONGINT_IMPL = NONE
1111
CIRCUITPY_FULL_BUILD = 0
12+
13+
CIRCUITPY_ONEWIREIO = 0

py/objexcept.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,17 +553,18 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
553553
mp_obj_exception_t *self = get_native_exception(self_in);
554554

555555
// Try to allocate memory for the traceback, with fallback to emergency traceback object
556-
557556
if (self->traceback == NULL || self->traceback == (mp_obj_traceback_t *)&mp_const_empty_traceback_obj) {
558557
self->traceback = m_new_obj_maybe(mp_obj_traceback_t);
559558
if (self->traceback == NULL) {
560559
self->traceback = &MP_STATE_VM(mp_emergency_traceback_obj);
561560
}
562561
}
563562

564-
// append this traceback info to traceback data
565-
// if memory allocation fails (eg because gc is locked), just return
563+
// populate traceback object
564+
*self->traceback = mp_const_empty_traceback_obj;
566565

566+
// append the provided traceback info to traceback data
567+
// if memory allocation fails (eg because gc is locked), just return
567568
if (self->traceback->data == NULL) {
568569
self->traceback->data = m_new_maybe(size_t, TRACEBACK_ENTRY_LEN);
569570
if (self->traceback->data == NULL) {

0 commit comments

Comments
 (0)