Skip to content

Commit 3b2fd4d

Browse files
committed
lib/utils/pyexec: Allow to compile when the uPy compiler is disabled.
1 parent e2f1a8a commit 3b2fd4d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/utils/pyexec.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
7575
} else
7676
#endif
7777
{
78+
#if MICROPY_ENABLE_COMPILER
7879
// source is a lexer, parse and compile the script
7980
mp_lexer_t *lex = source;
8081
qstr source_name = lex->source_name;
8182
mp_parse_tree_t parse_tree = mp_parse(lex, input_kind);
8283
module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, exec_flags & EXEC_FLAG_IS_REPL);
84+
#else
85+
mp_raise_msg(&mp_type_RuntimeError, "script compilation not supported");
86+
#endif
8387
}
8488

8589
// execute code
@@ -137,6 +141,7 @@ STATIC int parse_compile_execute(void *source, mp_parse_input_kind_t input_kind,
137141
return ret;
138142
}
139143

144+
#if MICROPY_ENABLE_COMPILER
140145
#if MICROPY_REPL_EVENT_DRIVEN
141146

142147
typedef struct _repl_t {
@@ -497,6 +502,7 @@ int pyexec_friendly_repl(void) {
497502
}
498503

499504
#endif // MICROPY_REPL_EVENT_DRIVEN
505+
#endif // MICROPY_ENABLE_COMPILER
500506

501507
int pyexec_file(const char *filename) {
502508
mp_lexer_t *lex = mp_lexer_new_from_file(filename);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy