Skip to content

Commit c0753c1

Browse files
committed
mp_obj_print_helper: Handle a ctrl-c that comes in during printing
In adafruit#2689, hitting ctrl-c during the printing of an object with a lot of sub-objects could cause the screen to stop updating (without showing a KeyboardInterrupt). This makes the printing of such objects acutally interruptable, and also correctly handles the KeyboardInterrupt: ``` >>> l = ["a" * 100] * 200 >>> l ['aaaaaaaaaaaaaaaaaaaaaa...aaaaaaaaaaa', Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyboardInterrupt: >>> ```
1 parent e9bc8e8 commit c0753c1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

py/obj.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
6767
#ifdef RUN_BACKGROUND_TASKS
6868
RUN_BACKGROUND_TASKS;
6969
#endif
70+
mp_handle_pending();
71+
7072
#ifndef NDEBUG
7173
if (o_in == MP_OBJ_NULL) {
7274
mp_print_str(print, "(nil)");

0 commit comments

Comments
 (0)