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:
Paul Sokolovsky
2014-05-11 20:32:39 +03:00
parent 0f570cfccf
commit c48d6f7add
2 changed files with 8 additions and 1 deletions

View File

@@ -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