summaryrefslogtreecommitdiff
path: root/lib/utils/pyexec.c
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /lib/utils/pyexec.c
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'lib/utils/pyexec.c')
-rwxr-xr-xlib/utils/pyexec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c
index e637fe544..c8e369e79 100755
--- a/lib/utils/pyexec.c
+++ b/lib/utils/pyexec.c
@@ -89,6 +89,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
}
// source is a lexer, parse and compile the script
qstr source_name = lex->source_name;
+ if (input_kind == MP_PARSE_FILE_INPUT) {
+ mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name));
+ }
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
// Clear the parse tree because it has a heap pointer we don't need anymore.
@@ -128,7 +131,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
// at the moment, the value of SystemExit is unused
ret = pyexec_system_exit;
} else {
- mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
+ if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) {
+ mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val);
+ }
ret = PYEXEC_EXCEPTION;
}
}