mirror of
https://github.com/micropython/micropython.git
synced 2026-01-06 12:10:13 +01:00
py: Don't expect that type->getiter() always returns iterator, check for NULL.
This is better than forcing each getiter() implementation to raise exception.
This commit is contained in:
1
py/vm.c
1
py/vm.c
@@ -663,6 +663,7 @@ unwind_jump:
|
||||
ENTRY(MP_BC_FOR_ITER):
|
||||
DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward
|
||||
save_sp = sp;
|
||||
assert(TOP());
|
||||
obj1 = mp_iternext_allow_raise(TOP());
|
||||
if (obj1 == MP_OBJ_STOP_ITERATION) {
|
||||
--sp; // pop the exhausted iterator
|
||||
|
||||
Reference in New Issue
Block a user