mp_obj_print_helper: Handle a ctrl-c that comes in during printing
In #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: >>> ```
This commit is contained in:
parent
e9bc8e892b
commit
c0753c1afb
2
py/obj.c
2
py/obj.c
@ -67,6 +67,8 @@ void mp_obj_print_helper(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t
|
|||||||
#ifdef RUN_BACKGROUND_TASKS
|
#ifdef RUN_BACKGROUND_TASKS
|
||||||
RUN_BACKGROUND_TASKS;
|
RUN_BACKGROUND_TASKS;
|
||||||
#endif
|
#endif
|
||||||
|
mp_handle_pending();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (o_in == MP_OBJ_NULL) {
|
if (o_in == MP_OBJ_NULL) {
|
||||||
mp_print_str(print, "(nil)");
|
mp_print_str(print, "(nil)");
|
||||||
|
Loading…
Reference in New Issue
Block a user