@@ -104,11 +104,12 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
104104 if (mp_obj_is_subclass_fast (mp_obj_get_type ((mp_obj_t )nlr .ret_val ), & mp_type_SystemExit )) {
105105 // at the moment, the value of SystemExit is unused
106106 ret = pyexec_system_exit ;
107- } else if (mp_obj_is_subclass_fast (mp_obj_get_type ((mp_obj_t )nlr .ret_val ), & mp_type_KeyboardInterrupt )) {
108- ret = PYEXEC_FORCED_EXIT ;
109107 } else {
110108 mp_obj_print_exception (& mp_plat_print , (mp_obj_t )nlr .ret_val );
111109 ret = PYEXEC_EXCEPTION ;
110+ if (mp_obj_is_subclass_fast (mp_obj_get_type ((mp_obj_t )nlr .ret_val ), & mp_type_KeyboardInterrupt )) {
111+ ret = PYEXEC_FORCED_EXIT ;
112+ }
112113 }
113114 }
114115 if (result != NULL ) {
@@ -217,10 +218,7 @@ STATIC int pyexec_raw_repl_process_char(int c) {
217218 if (lex == NULL ) {
218219 mp_hal_stdout_tx_str ("\x04MemoryError\r\n\x04" );
219220 } else {
220- int ret = parse_compile_execute (lex , MP_PARSE_FILE_INPUT , EXEC_FLAG_PRINT_EOF , NULL );
221- if (ret & PYEXEC_FORCED_EXIT ) {
222- return ret ;
223- }
221+ parse_compile_execute (lex , MP_PARSE_FILE_INPUT , EXEC_FLAG_PRINT_EOF , NULL );
224222 }
225223
226224reset :
@@ -299,10 +297,7 @@ exec: ;
299297 if (lex == NULL ) {
300298 printf ("MemoryError\n" );
301299 } else {
302- int ret = parse_compile_execute (lex , MP_PARSE_SINGLE_INPUT , EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL , NULL );
303- if (ret & PYEXEC_FORCED_EXIT ) {
304- return ret ;
305- }
300+ parse_compile_execute (lex , MP_PARSE_SINGLE_INPUT , EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL , NULL );
306301 }
307302
308303input_restart :
@@ -375,10 +370,7 @@ int pyexec_raw_repl(void) {
375370 if (lex == NULL ) {
376371 printf ("\x04MemoryError\n\x04" );
377372 } else {
378- int ret = parse_compile_execute (lex , MP_PARSE_FILE_INPUT , EXEC_FLAG_PRINT_EOF , NULL );
379- if (ret & PYEXEC_FORCED_EXIT ) {
380- return ret ;
381- }
373+ parse_compile_execute (lex , MP_PARSE_FILE_INPUT , EXEC_FLAG_PRINT_EOF , NULL );
382374 }
383375 }
384376}
@@ -501,10 +493,7 @@ int pyexec_friendly_repl(void) {
501493 if (lex == NULL ) {
502494 printf ("MemoryError\n" );
503495 } else {
504- ret = parse_compile_execute (lex , parse_input_kind , EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL , NULL );
505- if (ret & PYEXEC_FORCED_EXIT ) {
506- return ret ;
507- }
496+ parse_compile_execute (lex , parse_input_kind , EXEC_FLAG_ALLOW_DEBUGGING | EXEC_FLAG_IS_REPL , NULL );
508497 }
509498 }
510499}
0 commit comments