Skip to content

Commit 40a00c1

Browse files
authored
Merge pull request #5608 from microDev1/traceback
Traceback object init - set it to empty only if null
2 parents 932131b + ed9595a commit 40a00c1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

py/objexcept.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,10 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs
558558
if (self->traceback == NULL) {
559559
self->traceback = &MP_STATE_VM(mp_emergency_traceback_obj);
560560
}
561+
// populate traceback object
562+
*self->traceback = mp_const_empty_traceback_obj;
561563
}
562564

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

0 commit comments

Comments
 (0)