objgenerator: Another obscure case of propagating MP_OBJ_NULL optimization.

This commit is contained in:
Paul Sokolovsky 2014-03-31 04:08:42 +03:00
parent 1aa2c10263
commit 1eac05d541
1 changed files with 1 additions and 1 deletions

View File

@ -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)) { switch (mp_obj_gen_resume(self_in, send_value, throw_value, &ret)) {
case MP_VM_RETURN_NORMAL: case MP_VM_RETURN_NORMAL:
// Optimize return w/o value in case generator is used in for loop // 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; return MP_OBJ_NULL;
} else { } else {
nlr_jump(mp_obj_new_exception_args(&mp_type_StopIteration, 1, &ret)); nlr_jump(mp_obj_new_exception_args(&mp_type_StopIteration, 1, &ret));