Skip to content

Commit d7716de

Browse files
authored
Merge pull request adafruit#8840 from tannewt/reload_from_repl
Make `supervisor.reload()` from REPL work
2 parents 8cfa21c + 081686e commit d7716de

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ int __attribute__((used)) main(void) {
10991099
exit_code = run_repl(get_safe_mode());
11001100
supervisor_set_run_reason(RUN_REASON_REPL_RELOAD);
11011101
}
1102-
if (exit_code == PYEXEC_FORCED_EXIT) {
1102+
if (exit_code & (PYEXEC_FORCED_EXIT | PYEXEC_RELOAD)) {
11031103
if (!simulate_reset) {
11041104
serial_write_compressed(MP_ERROR_TEXT("soft reboot\n"));
11051105
}

shared/runtime/pyexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ int pyexec_raw_repl(void) {
602602
}
603603

604604
int ret = parse_compile_execute(&line, MP_PARSE_FILE_INPUT, EXEC_FLAG_PRINT_EOF | EXEC_FLAG_SOURCE_IS_VSTR, NULL);
605-
if (ret & PYEXEC_FORCED_EXIT) {
605+
if (ret & (PYEXEC_FORCED_EXIT | PYEXEC_RELOAD)) {
606606
return ret;
607607
}
608608
}
@@ -739,7 +739,7 @@ int pyexec_friendly_repl(void) {
739739
}
740740

741741
ret = parse_compile_execute(&line, parse_input_kind, EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL | EXEC_FLAG_SOURCE_IS_VSTR, NULL);
742-
if (ret & PYEXEC_FORCED_EXIT) {
742+
if (ret & (PYEXEC_FORCED_EXIT | PYEXEC_RELOAD)) {
743743
return ret;
744744
}
745745
}

0 commit comments

Comments
 (0)