Skip to content

Commit e9bc8e8

Browse files
committed
pyexec: Handle a ctrl-c that comes in "very late"
In relatively unusual circumstances, such as entering `l = 17 ** 17777` at the REPL, you could hit ctrl-c, but not get KeyboardInterrupt. This can lead to a condition where the display would stop updating (adafruit#2689).
1 parent 1033e89 commit e9bc8e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/utils/pyexec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
113113
start = mp_hal_ticks_ms();
114114
mp_call_function_0(module_fun);
115115
mp_hal_set_interrupt_char(-1); // disable interrupt
116+
// Handle any ctrl-c interrupt that arrived just in time
117+
mp_handle_pending();
116118
nlr_pop();
117119
ret = 0;
118120
if (exec_flags & EXEC_FLAG_PRINT_EOF) {

0 commit comments

Comments
 (0)