py: Make compiler return a proper exception on SyntaxError.

This commit is contained in:
Damien George
2014-10-05 19:01:34 +01:00
parent 6dba992182
commit a91ac2011f
10 changed files with 53 additions and 37 deletions

View File

@@ -36,8 +36,9 @@ void do_str(const char *src) {
mp_lexer_free(lex);
mp_obj_t module_fun = mp_compile(pn, source_name, MP_EMIT_OPT_NONE, true);
if (module_fun == mp_const_none) {
if (mp_obj_is_exception_instance(module_fun)) {
// compile error
mp_obj_print_exception(module_fun);
return;
}