summaryrefslogtreecommitdiffstatshomepage
path: root/py/vm.c
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 19:44:15 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2014-03-29 23:18:59 +0200
commitd109676ec0e8ebd648658583842ec3a91952adf3 (patch)
tree145b5dd9f638b77fafc7d70344eced8adcd3aad7 /py/vm.c
parentf4417a1f95eca0ef0a9446059e3ed070dd5e4b6f (diff)
downloadmicropython-d109676ec0e8ebd648658583842ec3a91952adf3.tar.gz
micropython-d109676ec0e8ebd648658583842ec3a91952adf3.zip
py: Reraising exception possible only in except block.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/py/vm.c b/py/vm.c
index f340f52190..d28416db3d 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -697,6 +697,9 @@ unwind_return:
unum = *ip++;
assert(unum <= 1);
if (unum == 0) {
+ if (!currently_in_except_block) {
+ nlr_jump(mp_obj_new_exception_msg(&mp_type_RuntimeError, "No active exception to reraise"));
+ }
// This assumes that nlr.ret_val holds last raised
// exception and is not overwritten since then.
obj1 = nlr.ret_val;