mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 04:30:24 +01:00
py: Improve exception bases, reduces ROM usage.
Thanks to @pfalcon for the tip!
This commit is contained in:
@@ -1003,6 +1003,8 @@ mp_obj_t rt_make_raise_obj(mp_obj_t o) {
|
||||
if (mp_obj_is_exception_type(o)) {
|
||||
// o is an exception type (it is derived from BaseException (or is BaseException))
|
||||
// create and return a new exception instance by calling o
|
||||
// TODO could have an option to disable traceback, then builtin exceptions (eg TypeError)
|
||||
// could have const instances in ROM which we return here instead
|
||||
return rt_call_function_n_kw(o, 0, 0, NULL);
|
||||
} else if (mp_obj_is_exception_instance(o)) {
|
||||
// o is an instance of an exception, so use it as the exception
|
||||
|
||||
Reference in New Issue
Block a user