py: Implement proper re-raising in native codegen's finally handler.
This allows an exception to propagate correctly through a finally
handler.
diff --git a/py/nativeglue.c b/py/nativeglue.c
index d52eeae..43e7d69 100644
--- a/py/nativeglue.c
+++ b/py/nativeglue.c
@@ -80,8 +80,11 @@
}
// 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