Skip to content

Commit ee5ecc9

Browse files
committed
objgenerator.throw: Instantiate if exception type passed, just as "raise".
Caught by CPython test_pep380.py.
1 parent 9a54a22 commit ee5ecc9

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

py/objgenerator.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send);
162162
STATIC mp_obj_t gen_instance_close(mp_obj_t self_in);
163163
STATIC mp_obj_t gen_instance_throw(uint n_args, const mp_obj_t *args) {
164164
mp_obj_t exc = (n_args == 2) ? args[1] : args[2];
165+
exc = rt_make_raise_obj(exc);
165166
if (mp_obj_is_subclass_fast(mp_obj_get_type(exc), &mp_type_GeneratorExit)) {
166167
// Throwing GeneratorExit is equivalent of calling close aka
167168
// GeneratorExit should be handled specially

0 commit comments

Comments
 (0)