mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
esp8266: Disallow recursive calls to REPL.
Before this change, if REPL blocked executing some code, it was possible to still input new statememts and excuting them, all leading to weird, and portentially dangerous interaction. TODO: Current implementation may have issues processing input accumulated while REPL was blocked.
This commit is contained in:
@@ -277,12 +277,17 @@ input_restart:
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t pyexec_repl_active;
|
||||
int pyexec_event_repl_process_char(int c) {
|
||||
pyexec_repl_active = 1;
|
||||
int res;
|
||||
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
|
||||
return pyexec_raw_repl_process_char(c);
|
||||
res = pyexec_raw_repl_process_char(c);
|
||||
} else {
|
||||
return pyexec_friendly_repl_process_char(c);
|
||||
res = pyexec_friendly_repl_process_char(c);
|
||||
}
|
||||
pyexec_repl_active = 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
#else // MICROPY_REPL_EVENT_DRIVEN
|
||||
|
||||
@@ -42,6 +42,7 @@ int pyexec_file(const char *filename);
|
||||
int pyexec_frozen_module(const char *name);
|
||||
void pyexec_event_repl_init(void);
|
||||
int pyexec_event_repl_process_char(int c);
|
||||
extern uint8_t pyexec_repl_active;
|
||||
|
||||
MP_DECLARE_CONST_FUN_OBJ(pyb_set_repl_info_obj);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user