summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/unix/main.c b/unix/main.c
index e3999db68b..f7b06d4f83 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -68,8 +68,11 @@ void do_repl() {
line = line3;
}
}
+
py_lexer_t *lex = py_lexer_new_from_str_len("<stdin>", line, strlen(line), false);
py_parse_node_t pn = py_parse(lex, PY_PARSE_SINGLE_INPUT);
+ py_lexer_free(lex);
+
if (pn != PY_PARSE_NODE_NULL) {
//py_parse_node_show(pn, 0);
bool comp_ok = py_compile(pn, true);
@@ -111,6 +114,8 @@ void do_file(const char *file) {
// compile
py_parse_node_t pn = py_parse(lex, PY_PARSE_FILE_INPUT);
+ py_lexer_free(lex);
+
if (pn != PY_PARSE_NODE_NULL) {
//printf("----------------\n");
//parse_node_show(pn, 0);
@@ -118,8 +123,6 @@ void do_file(const char *file) {
bool comp_ok = py_compile(pn, false);
//printf("----------------\n");
- py_lexer_free(lex);
-
#if MICROPY_EMIT_CPYTHON
if (!comp_ok) {
printf("compile error\n");