diff options
Diffstat (limited to 'unix')
-rw-r--r-- | unix/main.c | 14 | ||||
-rw-r--r-- | unix/mpconfigport.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/unix/main.c b/unix/main.c index d89f39da70..c33a439376 100644 --- a/unix/main.c +++ b/unix/main.c @@ -49,13 +49,14 @@ static void execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind return; } + qstr source_name = mp_lexer_source_name(lex); mp_lexer_free(lex); //printf("----------------\n"); - //parse_node_show(pn, 0); + //mp_parse_node_show(pn, 0); //printf("----------------\n"); - mp_obj_t module_fun = mp_compile(pn, is_repl); + mp_obj_t module_fun = mp_compile(pn, source_name, is_repl); if (module_fun == mp_const_none) { // compile error @@ -69,7 +70,14 @@ static void execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t input_kind nlr_pop(); } else { // uncaught exception - mp_obj_print((mp_obj_t)nlr.ret_val, PRINT_REPR); + mp_obj_t exc = (mp_obj_t)nlr.ret_val; + if (MP_OBJ_IS_TYPE(exc, &exception_type)) { + qstr file; + machine_uint_t line; + mp_obj_exception_get_source_info(exc, &file, &line); + printf("File \"%s\", line %d\n", qstr_str(file), (int)line); + } + mp_obj_print(exc, PRINT_REPR); printf("\n"); } } diff --git a/unix/mpconfigport.h b/unix/mpconfigport.h index daa18961c0..b36c171969 100644 --- a/unix/mpconfigport.h +++ b/unix/mpconfigport.h @@ -13,6 +13,7 @@ #define MICROPY_ENABLE_LEXER_UNIX (1) #define MICROPY_ENABLE_FLOAT (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_LONGLONG) +#define MICROPY_SHOW_BC (0) // type definitions for the specific machine |