From 0bfc7638baa4c5a4a2351364ab770a188dcab302 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 7 Feb 2015 18:33:58 +0000 Subject: 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. --- py/compile.h | 1 + 1 file changed, 1 insertion(+) (limited to 'py/compile.h') diff --git a/py/compile.h b/py/compile.h index 9d612da53..2d15de8b9 100644 --- a/py/compile.h +++ b/py/compile.h @@ -39,6 +39,7 @@ enum { MP_EMIT_OPT_ASM_THUMB, }; +// the compiler will raise an exception if an error occurred // the compiler will free the parse tree (pn) before it returns mp_obj_t mp_compile(mp_parse_node_t pn, qstr source_file, uint emit_opt, bool is_repl); -- cgit v1.2.3