Skip to content

Commit e7a4782

Browse files
committed
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.
1 parent efa04ea commit e7a4782

7 files changed

Lines changed: 12 additions & 15 deletions

File tree

py/builtintables.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ STATIC const mp_map_elem_t mp_builtin_object_table[] = {
136136
{ MP_OBJ_NEW_QSTR(MP_QSTR_RuntimeError), (mp_obj_t)&mp_type_RuntimeError },
137137
{ MP_OBJ_NEW_QSTR(MP_QSTR_StopIteration), (mp_obj_t)&mp_type_StopIteration },
138138
{ MP_OBJ_NEW_QSTR(MP_QSTR_SyntaxError), (mp_obj_t)&mp_type_SyntaxError },
139-
{ MP_OBJ_NEW_QSTR(MP_QSTR_SystemError), (mp_obj_t)&mp_type_SystemError },
140139
{ MP_OBJ_NEW_QSTR(MP_QSTR_SystemExit), (mp_obj_t)&mp_type_SystemExit },
141140
{ MP_OBJ_NEW_QSTR(MP_QSTR_TypeError), (mp_obj_t)&mp_type_TypeError },
142141
{ MP_OBJ_NEW_QSTR(MP_QSTR_ValueError), (mp_obj_t)&mp_type_ValueError },

py/obj.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ extern const mp_obj_type_t mp_type_OverflowError;
339339
extern const mp_obj_type_t mp_type_RuntimeError;
340340
extern const mp_obj_type_t mp_type_StopIteration;
341341
extern const mp_obj_type_t mp_type_SyntaxError;
342-
extern const mp_obj_type_t mp_type_SystemError;
343342
extern const mp_obj_type_t mp_type_SystemExit;
344343
extern const mp_obj_type_t mp_type_TypeError;
345344
extern const mp_obj_type_t mp_type_ValueError;

py/objexcept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ MP_DEFINE_EXCEPTION(Exception, BaseException)
268268
MP_DEFINE_EXCEPTION_BASE(IndentationError)
269269
MP_DEFINE_EXCEPTION(TabError, IndentationError)
270270
*/
271-
MP_DEFINE_EXCEPTION(SystemError, Exception)
271+
//MP_DEFINE_EXCEPTION(SystemError, Exception)
272272
MP_DEFINE_EXCEPTION(TypeError, Exception)
273273
MP_DEFINE_EXCEPTION(ValueError, Exception)
274274
//TODO: Implement UnicodeErrors which take arguments

py/qstrdefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ Q(OSError)
117117
Q(OverflowError)
118118
Q(RuntimeError)
119119
Q(SyntaxError)
120-
Q(SystemError)
121120
Q(SystemExit)
122121
Q(TypeError)
123122
Q(UnboundLocalError)

tests/basics/exceptpoly.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,15 @@
298298
#except SyntaxWarning:
299299
# print("Caught SyntaxWarning")
300300

301-
try:
302-
raise SystemError
303-
except Exception:
304-
print("Caught SystemError via Exception")
301+
#try:
302+
# raise SystemError
303+
#except Exception:
304+
# print("Caught SystemError via Exception")
305305

306-
try:
307-
raise SystemError
308-
except SystemError:
309-
print("Caught SystemError")
306+
#try:
307+
# raise SystemError
308+
#except SystemError:
309+
# print("Caught SystemError")
310310

311311
#try:
312312
# raise TabError

tests/micropython/viper_misc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def viper_set(x, y:int):
6969
# raising an exception
7070
@micropython.viper
7171
def viper_raise(x:int):
72-
raise SystemError(x)
72+
raise OSError(x)
7373
try:
7474
viper_raise(1)
75-
except SystemError as e:
75+
except OSError as e:
7676
print(repr(e))
7777

7878
# this doesn't work at the moment

tests/micropython/viper_misc.py.exp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
(1, 3)
99
[1, 3]
1010
[1, 3]
11-
SystemError(1,)
11+
OSError(1,)
1212
1
1313
1

0 commit comments

Comments
 (0)