File tree 4 files changed +12
-1
lines changed
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[] = {
683
683
{ MP_OBJ_NEW_QSTR (MP_QSTR_SyntaxError ), (mp_obj_t )& mp_type_SyntaxError },
684
684
{ MP_OBJ_NEW_QSTR (MP_QSTR_SystemExit ), (mp_obj_t )& mp_type_SystemExit },
685
685
{ 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
686
689
{ MP_OBJ_NEW_QSTR (MP_QSTR_ValueError ), (mp_obj_t )& mp_type_ValueError },
687
690
{ MP_OBJ_NEW_QSTR (MP_QSTR_ZeroDivisionError ), (mp_obj_t )& mp_type_ZeroDivisionError },
688
691
// 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;
369
369
extern const mp_obj_type_t mp_type_SyntaxError ;
370
370
extern const mp_obj_type_t mp_type_SystemExit ;
371
371
extern const mp_obj_type_t mp_type_TypeError ;
372
+ extern const mp_obj_type_t mp_type_UnicodeError ;
372
373
extern const mp_obj_type_t mp_type_ValueError ;
373
374
extern const mp_obj_type_t mp_type_ZeroDivisionError ;
374
375
Original file line number Diff line number Diff line change @@ -249,7 +249,11 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
249
249
//MP_DEFINE_EXCEPTION(SystemError, Exception)
250
250
MP_DEFINE_EXCEPTION (TypeError , Exception )
251
251
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
253
257
/*
254
258
MP_DEFINE_EXCEPTION(Warning, Exception)
255
259
MP_DEFINE_EXCEPTION_BASE(Warning)
Original file line number Diff line number Diff line change @@ -137,6 +137,9 @@ Q(TypeError)
137
137
Q (UnboundLocalError )
138
138
Q (ValueError )
139
139
Q (ZeroDivisionError )
140
+ #if MICROPY_PY_BUILTINS_STR_UNICODE
141
+ Q (UnicodeError )
142
+ #endif
140
143
141
144
Q (None )
142
145
Q (False )
You can’t perform that action at this time.
0 commit comments