From 1eac05d5414678d23cff3d1dde8bd234c4edcc0b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 31 Mar 2014 04:08:42 +0300 Subject: [PATCH] objgenerator: Another obscure case of propagating MP_OBJ_NULL optimization. --- py/objgenerator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/objgenerator.c b/py/objgenerator.c index 8f6bb17cfd..5f0f6c3eba 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -127,7 +127,7 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o switch (mp_obj_gen_resume(self_in, send_value, throw_value, &ret)) { case MP_VM_RETURN_NORMAL: // Optimize return w/o value in case generator is used in for loop - if (ret == mp_const_none) { + if (ret == mp_const_none || ret == MP_OBJ_NULL) { return MP_OBJ_NULL; } else { nlr_jump(mp_obj_new_exception_args(&mp_type_StopIteration, 1, &ret));