py/vm: "yield from" didn't handle MP_OBJ_STOP_ITERATION optimization.

E.g. crashed when yielding from already stopped generators.
This commit is contained in:
Paul Sokolovsky
2016-04-28 01:54:23 +03:00
parent d54290f6e2
commit eff85bb1dc
2 changed files with 3 additions and 1 deletions

View File

@@ -1144,7 +1144,8 @@ yield:
if (ret_kind == MP_VM_RETURN_NORMAL) {
// Pop exhausted gen
sp--;
if (ret_value == MP_OBJ_NULL) {
// TODO: When ret_value can be MP_OBJ_NULL here??
if (ret_value == MP_OBJ_NULL || ret_value == MP_OBJ_STOP_ITERATION) {
// Optimize StopIteration
// TODO: get StopIteration's value
PUSH(mp_const_none);