summaryrefslogtreecommitdiffstatshomepage
path: root/py/runtime.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-18 12:46:43 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-01-18 12:46:43 +0200
commit166bb40fb22b9c43209ce9792b6a8d48276ef7fa (patch)
tree36dbf729377e077b37d4b5489347ee0a27b08425 /py/runtime.c
parent8655065f8cec8b978d075adae1f65ffdfa9b51d8 (diff)
downloadmicropython-166bb40fb22b9c43209ce9792b6a8d48276ef7fa.tar.gz
micropython-166bb40fb22b9c43209ce9792b6a8d48276ef7fa.zip
Add OverflowError and use it for small int overflow instead of assert.
Diffstat (limited to 'py/runtime.c')
-rw-r--r--py/runtime.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/runtime.c b/py/runtime.c
index d6ef6f9be2..0d1381cff8 100644
--- a/py/runtime.c
+++ b/py/runtime.c
@@ -89,6 +89,9 @@ void rt_init(void) {
mp_map_add_qstr(&map_builtins, MP_QSTR_TypeError, mp_obj_new_exception(MP_QSTR_TypeError));
mp_map_add_qstr(&map_builtins, MP_QSTR_SyntaxError, mp_obj_new_exception(MP_QSTR_SyntaxError));
mp_map_add_qstr(&map_builtins, MP_QSTR_ValueError, mp_obj_new_exception(MP_QSTR_ValueError));
+ // Somehow CPython managed to have OverflowError not inherit from ValueError ;-/
+ // TODO: For MICROPY_CPYTHON_COMPAT==0 use ValueError to avoid exc proliferation
+ mp_map_add_qstr(&map_builtins, MP_QSTR_OverflowError, mp_obj_new_exception(MP_QSTR_OverflowError));
mp_map_add_qstr(&map_builtins, MP_QSTR_OSError, mp_obj_new_exception(MP_QSTR_OSError));
mp_map_add_qstr(&map_builtins, MP_QSTR_AssertionError, mp_obj_new_exception(MP_QSTR_AssertionError));