Merge pull request #5152 from microDev1/traceback

Fix crash on raise of reload exception
This commit is contained in:
Dan Halbert 2021-08-15 08:25:17 -04:00 committed by GitHub
commit 6e885c8610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -146,6 +146,8 @@ typedef struct _mp_state_vm_t {
// exception object of type ReloadException
mp_obj_exception_t mp_reload_exception;
// traceback object to store traceback
mp_obj_traceback_t mp_reload_traceback;
// dictionary with loaded modules (may be exposed as sys.modules)
mp_obj_dict_t mp_loaded_modules_dict;

View File

@ -86,7 +86,8 @@ void mp_init(void) {
MP_STATE_VM(mp_reload_exception).base.type = &mp_type_ReloadException;
MP_STATE_VM(mp_reload_exception).args = (mp_obj_tuple_t *)&mp_const_empty_tuple_obj;
MP_STATE_VM(mp_reload_exception).traceback = (mp_obj_traceback_t *)&mp_const_empty_traceback_obj;
MP_STATE_VM(mp_reload_exception).traceback = &MP_STATE_VM(mp_reload_traceback);
*MP_STATE_VM(mp_reload_exception).traceback = mp_const_empty_traceback_obj;
// call port specific initialization if any
#ifdef MICROPY_PORT_INIT_FUNC