summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2020-08-21 10:30:09 +1000
committerDamien George <damien@micropython.org>2020-08-22 11:38:46 +1000
commit5f9b105244bb9f605f3ca157cd421967c665bd6e (patch)
treea0c71dca66b5f52e214399e21b051ba204173b5d /py
parent448319a7450714efd72ae527e184a247a82ee39d (diff)
py/runtime: Fix builtin compile() in "single" mode so it prints exprs.
As per CPython behaviour, compile(stmt, "file", "single") should create code which prints to stdout (via __repl_print__) the results of any expressions in stmt. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py')
-rw-r--r--py/runtime.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/runtime.c b/py/runtime.c
index 38da2f453..c12271f4e 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -1473,7 +1473,7 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
if (nlr_push(&nlr) == 0) {
qstr source_name = lex->source_name;
mp_parse_tree_t parse_tree = mp_parse(lex, parse_input_kind);
- mp_obj_t module_fun = mp_compile(&parse_tree, source_name, false);
+ mp_obj_t module_fun = mp_compile(&parse_tree, source_name, parse_input_kind == MP_PARSE_SINGLE_INPUT);
mp_obj_t ret;
if (MICROPY_PY_BUILTINS_COMPILE && globals == NULL) {