Skip to content

Commit a73859d

Browse files
laurensvalkdpgeorge
authored andcommitted
py/objgenerator: Add missing #if guard for PY_GENERATOR_PEND_THROW.
Without it, gen_instance_pend_throw_obj is defined but not used when MICROPY_PY_GENERATOR_PEND_THROW is set to 0.
1 parent a1c870e commit a73859d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

py/objgenerator.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ STATIC mp_obj_t gen_instance_close(mp_obj_t self_in) {
297297
}
298298
STATIC MP_DEFINE_CONST_FUN_OBJ_1(gen_instance_close_obj, gen_instance_close);
299299

300+
#if MICROPY_PY_GENERATOR_PEND_THROW
300301
STATIC mp_obj_t gen_instance_pend_throw(mp_obj_t self_in, mp_obj_t exc_in) {
301302
mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in);
302303
if (self->code_state.sp == self->code_state.state - 1) {
@@ -307,6 +308,7 @@ STATIC mp_obj_t gen_instance_pend_throw(mp_obj_t self_in, mp_obj_t exc_in) {
307308
return prev;
308309
}
309310
STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_pend_throw_obj, gen_instance_pend_throw);
311+
#endif
310312

311313
STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table[] = {
312314
{ MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&gen_instance_close_obj) },

0 commit comments

Comments
 (0)