Skip to content
Snippets Groups Projects
Commit 6433f71e authored by Tom Soulanille's avatar Tom Soulanille Committed by Damien George
Browse files

py/objgetitemiter: Make it_iternext() recognize IndexError.

parent a3fe3074
No related branches found
No related tags found
No related merge requests found
......@@ -47,8 +47,9 @@ STATIC mp_obj_t it_iternext(mp_obj_t self_in) {
return value;
} else {
// an exception was raised
if (mp_obj_get_type(nlr.ret_val) == &mp_type_StopIteration) {
// return MP_OBJ_STOP_ITERATION instead of raising StopIteration
mp_obj_type_t *t = mp_obj_get_type(nlr.ret_val);
if (t == &mp_type_StopIteration || t == &mp_type_IndexError) {
// return MP_OBJ_STOP_ITERATION instead of raising
return MP_OBJ_STOP_ITERATION;
} else {
// re-raise exception
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment