diff options
| author | Paul Sokolovsky | 2014-12-06 14:29:09 +0200 |
|---|---|---|
| committer | Damien George | 2014-12-08 20:25:49 +0000 |
| commit | 46c3ab20049af16e97863e90e5761fae329f872a (patch) | |
| tree | cbe6230dcad6972d7d50c6d08c4e4c4da215abb1 /stmhal/pyexec.c | |
| parent | d0caaadaeea48e8f76dca3125a2dea3465a58416 (diff) | |
modsys: Add sys.print_exception(exc, file=sys.stdout) function.
The function is modeled after traceback.print_exception(), but unbloated,
and put into existing module to save overhead on adding another module.
Compliant traceback.print_exception() is intended to be implemented in
micropython-lib in terms of sys.print_exception().
This change required refactoring mp_obj_print_exception() to take pfenv_t
interface arguments.
Addresses #751.
Diffstat (limited to 'stmhal/pyexec.c')
| -rw-r--r-- | stmhal/pyexec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/stmhal/pyexec.c b/stmhal/pyexec.c index 36a496aa1..d62b2a373 100644 --- a/stmhal/pyexec.c +++ b/stmhal/pyexec.c @@ -48,6 +48,7 @@ #include "pyexec.h" #include "pybstdio.h" #include "genhdr/py-version.h" +#include "pfenv.h" pyexec_mode_kind_t pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; STATIC bool repl_display_debugging_info = 0; @@ -87,7 +88,7 @@ STATIC int parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_ki if (exec_flags & EXEC_FLAG_PRINT_EOF) { stdout_tx_strn("\x04", 1); } - mp_obj_print_exception(module_fun); + mp_obj_print_exception(printf_wrapper, NULL, module_fun); goto finish; } @@ -116,7 +117,7 @@ STATIC int parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t input_ki // at the moment, the value of SystemExit is unused ret = PYEXEC_FORCED_EXIT; } else { - mp_obj_print_exception((mp_obj_t)nlr.ret_val); + mp_obj_print_exception(printf_wrapper, NULL, (mp_obj_t)nlr.ret_val); ret = 0; } } |
