diff options
author | Damien George <damien.p.george@gmail.com> | 2015-04-20 13:29:31 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-04-20 13:29:31 +0000 |
commit | c8b60f013b9d624a74ad502460f2bc7d00c39644 (patch) | |
tree | 4fdc71a6e6963961e0591b3abc621d672bb1c645 /py/modbuiltins.c | |
parent | 2bb5f41611ddc90cf44090e87efd94523580008b (diff) |
py: Make viper codegen raise proper exception (ViperTypeError) on error.
This fixes a long standing problem that viper code generation gave
terrible error messages, and actually no errors on pyboard where
assertions are disabled.
Now all compile-time errors are raised as proper Python exceptions, and
are of type ViperTypeError.
Addresses issue #940.
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r-- | py/modbuiltins.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c index bec47787c..455e1cc1b 100644 --- a/py/modbuiltins.c +++ b/py/modbuiltins.c @@ -703,6 +703,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_UnicodeError), (mp_obj_t)&mp_type_UnicodeError }, #endif { MP_OBJ_NEW_QSTR(MP_QSTR_ValueError), (mp_obj_t)&mp_type_ValueError }, + #if MICROPY_EMIT_NATIVE + { MP_OBJ_NEW_QSTR(MP_QSTR_ViperTypeError), (mp_obj_t)&mp_type_ViperTypeError }, + #endif { MP_OBJ_NEW_QSTR(MP_QSTR_ZeroDivisionError), (mp_obj_t)&mp_type_ZeroDivisionError }, // Somehow CPython managed to have OverflowError not inherit from ValueError ;-/ // TODO: For MICROPY_CPYTHON_COMPAT==0 use ValueError to avoid exc proliferation |