From 22a0865d54579253c97a0d5916cc7b93bf8a049c Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 15 Feb 2014 21:05:25 +0000 Subject: py: Improve exception bases, reduces ROM usage. Thanks to @pfalcon for the tip! --- py/runtime.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'py/runtime.c') diff --git a/py/runtime.c b/py/runtime.c index aa7940fd8..798f7b671 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -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 -- cgit v1.2.3