diff options
author | Damien George <damien.p.george@gmail.com> | 2015-02-07 18:33:58 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-02-07 18:33:58 +0000 |
commit | 0bfc7638baa4c5a4a2351364ab770a188dcab302 (patch) | |
tree | 0127fcea13a875d37dd9cfa07dc6921bf387c578 /py/compile.c | |
parent | e1e359ff59d6bbf09441cc1f3965be63f1046182 (diff) | |
download | micropython-0bfc7638baa4c5a4a2351364ab770a188dcab302.tar.gz micropython-0bfc7638baa4c5a4a2351364ab770a188dcab302.zip |
py: Protect mp_parse and mp_compile with nlr push/pop block.
To enable parsing constants more efficiently, mp_parse should be allowed
to raise an exception, and mp_compile can already raise a MemoryError.
So these functions need to be protected by an nlr push/pop block.
This patch adds that feature in all places. This allows to simplify how
mp_parse and mp_compile are called: they now raise an exception if they
have an error and so explicit checking is not needed anymore.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/py/compile.c b/py/compile.c index 8e4723f230..7023e9c403 100644 --- a/py/compile.c +++ b/py/compile.c @@ -3823,7 +3823,7 @@ mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is m_del_obj(compiler_t, comp); if (compile_error != MP_OBJ_NULL) { - return compile_error; + nlr_raise(compile_error); } else { #if MICROPY_EMIT_CPYTHON // can't create code, so just return true |