summaryrefslogtreecommitdiffstatshomepage
path: root/py/builtinimport.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-10-05 19:01:34 +0100
committerDamien George <damien.p.george@gmail.com>2014-10-05 19:01:34 +0100
commita91ac2011f0131ce550bf227d78ccccbdab4f882 (patch)
tree4efcd77de48edbf4017307babe46e9e6b1337c17 /py/builtinimport.c
parent6dba992182af9b3a73711958de2eeeb33b7f69f6 (diff)
downloadmicropython-a91ac2011f0131ce550bf227d78ccccbdab4f882.tar.gz
micropython-a91ac2011f0131ce550bf227d78ccccbdab4f882.zip
py: Make compiler return a proper exception on SyntaxError.
Diffstat (limited to 'py/builtinimport.c')
-rw-r--r--py/builtinimport.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/py/builtinimport.c b/py/builtinimport.c
index 7270e1f840..04786b2104 100644
--- a/py/builtinimport.c
+++ b/py/builtinimport.c
@@ -142,11 +142,10 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) {
// compile the imported script
mp_obj_t module_fun = mp_compile(pn, source_name, MP_EMIT_OPT_NONE, false);
- if (module_fun == mp_const_none) {
- // TODO handle compile error correctly
+ if (mp_obj_is_exception_instance(module_fun)) {
mp_locals_set(old_locals);
mp_globals_set(old_globals);
- nlr_raise(mp_obj_new_exception_msg(&mp_type_SyntaxError, "Syntax error in imported module"));
+ nlr_raise(module_fun);
}
// complied successfully, execute it