summaryrefslogtreecommitdiffstatshomepage
path: root/py/nativeglue.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-01-21 17:00:01 +0000
committerDamien George <damien.p.george@gmail.com>2015-01-21 17:00:01 +0000
commitb6e6b5277f4fb966d8090e362f187d36117b2db6 (patch)
treee69854cabd65616698610aa381d5fa5660a34fd2 /py/nativeglue.c
parent962a5d50c94f01ca8dc7d46fe568535d713d59d0 (diff)
downloadmicropython-b6e6b5277f4fb966d8090e362f187d36117b2db6.tar.gz
micropython-b6e6b5277f4fb966d8090e362f187d36117b2db6.zip
py: Implement proper re-raising in native codegen's finally handler.
This allows an exception to propagate correctly through a finally handler.
Diffstat (limited to 'py/nativeglue.c')
-rw-r--r--py/nativeglue.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/py/nativeglue.c b/py/nativeglue.c
index d52eeaeaa5..43e7d699ff 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -80,8 +80,11 @@ mp_obj_t mp_native_call_function_n_kw(mp_obj_t fun_in, mp_uint_t n_args_kw, cons
}
// wrapper that makes raise obj and raises it
-NORETURN void mp_native_raise(mp_obj_t o) {
- nlr_raise(mp_make_raise_obj(o));
+// END_FINALLY opcode requires that we don't raise if o==None
+void mp_native_raise(mp_obj_t o) {
+ if (o != mp_const_none) {
+ nlr_raise(mp_make_raise_obj(o));
+ }
}
// these must correspond to the respective enum in runtime0.h