File tree Expand file tree Collapse file tree 4 files changed +12
-1
lines changed
Expand file tree Collapse file tree 4 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -683,6 +683,9 @@ STATIC const mp_map_elem_t mp_module_builtins_globals_table[] = {
683683 { MP_OBJ_NEW_QSTR (MP_QSTR_SyntaxError ), (mp_obj_t )& mp_type_SyntaxError },
684684 { MP_OBJ_NEW_QSTR (MP_QSTR_SystemExit ), (mp_obj_t )& mp_type_SystemExit },
685685 { MP_OBJ_NEW_QSTR (MP_QSTR_TypeError ), (mp_obj_t )& mp_type_TypeError },
686+ #if MICROPY_PY_BUILTINS_STR_UNICODE
687+ { MP_OBJ_NEW_QSTR (MP_QSTR_UnicodeError ), (mp_obj_t )& mp_type_UnicodeError },
688+ #endif
686689 { MP_OBJ_NEW_QSTR (MP_QSTR_ValueError ), (mp_obj_t )& mp_type_ValueError },
687690 { MP_OBJ_NEW_QSTR (MP_QSTR_ZeroDivisionError ), (mp_obj_t )& mp_type_ZeroDivisionError },
688691 // Somehow CPython managed to have OverflowError not inherit from ValueError ;-/
Original file line number Diff line number Diff line change @@ -369,6 +369,7 @@ extern const mp_obj_type_t mp_type_StopIteration;
369369extern const mp_obj_type_t mp_type_SyntaxError ;
370370extern const mp_obj_type_t mp_type_SystemExit ;
371371extern const mp_obj_type_t mp_type_TypeError ;
372+ extern const mp_obj_type_t mp_type_UnicodeError ;
372373extern const mp_obj_type_t mp_type_ValueError ;
373374extern const mp_obj_type_t mp_type_ZeroDivisionError ;
374375
Original file line number Diff line number Diff line change @@ -249,7 +249,11 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
249249 //MP_DEFINE_EXCEPTION(SystemError, Exception)
250250 MP_DEFINE_EXCEPTION (TypeError , Exception )
251251 MP_DEFINE_EXCEPTION (ValueError , Exception )
252- //TODO: Implement UnicodeErrors which take arguments
252+ #if MICROPY_PY_BUILTINS_STR_UNICODE
253+ MP_DEFINE_EXCEPTION_BASE (ValueError )
254+ MP_DEFINE_EXCEPTION (UnicodeError , ValueError )
255+ //TODO: Implement more UnicodeError subclasses which take arguments
256+ #endif
253257 /*
254258 MP_DEFINE_EXCEPTION(Warning, Exception)
255259 MP_DEFINE_EXCEPTION_BASE(Warning)
Original file line number Diff line number Diff line change @@ -137,6 +137,9 @@ Q(TypeError)
137137Q (UnboundLocalError )
138138Q (ValueError )
139139Q (ZeroDivisionError )
140+ #if MICROPY_PY_BUILTINS_STR_UNICODE
141+ Q (UnicodeError )
142+ #endif
140143
141144Q (None )
142145Q (False )
You can’t perform that action at this time.
0 commit comments