aboutsummaryrefslogtreecommitdiff
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2018-09-28 11:35:37 +1000
committerDamien George <damien.p.george@gmail.com>2018-09-28 11:39:35 +1000
commit0c9d4523705c0b7f156e92611001dfb3ea26424a (patch)
treec2e0cc959e3122dd76bb16dfee2e4feadbe18bbd /py/vm.c
parente6078dfed21470dd3b0f3a5e33c78b7db3501711 (diff)
py/vm: Fix case of throwing GeneratorExit type into yield-from.
mp_make_raise_obj must be used to convert a possible exception type to an instance object, otherwise the VM may raise a non-exception object. An existing test is adjusted to test this case, with the original test already moved to generator_throw.py.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/vm.c b/py/vm.c
index a7c9da0ce..8da40c9b6 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -1152,7 +1152,7 @@ yield:
MARK_EXC_IP_SELECTIVE();
//#define EXC_MATCH(exc, type) MP_OBJ_IS_TYPE(exc, type)
#define EXC_MATCH(exc, type) mp_obj_exception_match(exc, type)
-#define GENERATOR_EXIT_IF_NEEDED(t) if (t != MP_OBJ_NULL && EXC_MATCH(t, MP_OBJ_FROM_PTR(&mp_type_GeneratorExit))) { RAISE(t); }
+#define GENERATOR_EXIT_IF_NEEDED(t) if (t != MP_OBJ_NULL && EXC_MATCH(t, MP_OBJ_FROM_PTR(&mp_type_GeneratorExit))) { mp_obj_t raise_t = mp_make_raise_obj(t); RAISE(raise_t); }
mp_vm_return_kind_t ret_kind;
mp_obj_t send_value = POP();
mp_obj_t t_exc = MP_OBJ_NULL;