kopia lustrzana https://github.com/micropython/micropython
py: Remove unused and unneeded SystemError exception.
It's purpose is for internal errors that are not catastrophic (ie not as bad as RuntimeError). Since we don't use it, we don't need it.pull/923/merge
rodzic
efa04eafd3
commit
e7a478204a
|
@ -136,7 +136,6 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
|
|||
{ MP_OBJ_NEW_QSTR(MP_QSTR_RuntimeError), (mp_obj_t)&mp_type_RuntimeError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_StopIteration), (mp_obj_t)&mp_type_StopIteration },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SyntaxError), (mp_obj_t)&mp_type_SyntaxError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SystemError), (mp_obj_t)&mp_type_SystemError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_SystemExit), (mp_obj_t)&mp_type_SystemExit },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_TypeError), (mp_obj_t)&mp_type_TypeError },
|
||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_ValueError), (mp_obj_t)&mp_type_ValueError },
|
||||
|
|
1
py/obj.h
1
py/obj.h
|
@ -339,7 +339,6 @@ extern const mp_obj_type_t mp_type_OverflowError;
|
|||
extern const mp_obj_type_t mp_type_RuntimeError;
|
||||
extern const mp_obj_type_t mp_type_StopIteration;
|
||||
extern const mp_obj_type_t mp_type_SyntaxError;
|
||||
extern const mp_obj_type_t mp_type_SystemError;
|
||||
extern const mp_obj_type_t mp_type_SystemExit;
|
||||
extern const mp_obj_type_t mp_type_TypeError;
|
||||
extern const mp_obj_type_t mp_type_ValueError;
|
||||
|
|
|
@ -268,7 +268,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
|
|||
MP_DEFINE_EXCEPTION_BASE(IndentationError)
|
||||
MP_DEFINE_EXCEPTION(TabError, IndentationError)
|
||||
*/
|
||||
MP_DEFINE_EXCEPTION(SystemError, Exception)
|
||||
//MP_DEFINE_EXCEPTION(SystemError, Exception)
|
||||
MP_DEFINE_EXCEPTION(TypeError, Exception)
|
||||
MP_DEFINE_EXCEPTION(ValueError, Exception)
|
||||
//TODO: Implement UnicodeErrors which take arguments
|
||||
|
|
|
@ -117,7 +117,6 @@ Q(OSError)
|
|||
Q(OverflowError)
|
||||
Q(RuntimeError)
|
||||
Q(SyntaxError)
|
||||
Q(SystemError)
|
||||
Q(SystemExit)
|
||||
Q(TypeError)
|
||||
Q(UnboundLocalError)
|
||||
|
|
|
@ -298,15 +298,15 @@ except SyntaxError:
|
|||
#except SyntaxWarning:
|
||||
# print("Caught SyntaxWarning")
|
||||
|
||||
try:
|
||||
raise SystemError
|
||||
except Exception:
|
||||
print("Caught SystemError via Exception")
|
||||
#try:
|
||||
# raise SystemError
|
||||
#except Exception:
|
||||
# print("Caught SystemError via Exception")
|
||||
|
||||
try:
|
||||
raise SystemError
|
||||
except SystemError:
|
||||
print("Caught SystemError")
|
||||
#try:
|
||||
# raise SystemError
|
||||
#except SystemError:
|
||||
# print("Caught SystemError")
|
||||
|
||||
#try:
|
||||
# raise TabError
|
||||
|
|
|
@ -69,10 +69,10 @@ print(sorted(list(viper_set(1, 2))))
|
|||
# raising an exception
|
||||
@micropython.viper
|
||||
def viper_raise(x:int):
|
||||
raise SystemError(x)
|
||||
raise OSError(x)
|
||||
try:
|
||||
viper_raise(1)
|
||||
except SystemError as e:
|
||||
except OSError as e:
|
||||
print(repr(e))
|
||||
|
||||
# this doesn't work at the moment
|
||||
|
|
|
@ -8,6 +8,6 @@
|
|||
(1, 3)
|
||||
[1, 3]
|
||||
[1, 3]
|
||||
SystemError(1,)
|
||||
OSError(1,)
|
||||
1
|
||||
1
|
||||
|
|
Ładowanie…
Reference in New Issue