py/runtime: Initialize profile fields in mp_thread_init_state.
If the fields added for `MICROPY_PY_SYS_SETTRACE` are not initialized properly, their value in a thread is indeterminate. In particular, if the callback is not NULL, it will be invoked as a function. Signed-off-by: Jeff Epler <jepler@gmail.com>
This commit is contained in:
committed by
Damien George
parent
ff8c4e5943
commit
f04475afd8
@@ -169,6 +169,12 @@ static inline void mp_thread_init_state(mp_state_thread_t *ts, size_t stack_size
|
||||
ts->nlr_jump_callback_top = NULL;
|
||||
ts->mp_pending_exception = MP_OBJ_NULL;
|
||||
|
||||
#if MICROPY_PY_SYS_SETTRACE
|
||||
ts->prof_trace_callback = MP_OBJ_NULL;
|
||||
ts->prof_callback_is_executing = false;
|
||||
ts->current_code_state = NULL;
|
||||
#endif
|
||||
|
||||
// If locals/globals are not given, inherit from main thread
|
||||
if (locals == NULL) {
|
||||
locals = mp_state_ctx.thread.dict_locals;
|
||||
|
||||
Reference in New Issue
Block a user