Skip to content

Commit 76ef074

Browse files
committed
Release source when PyIterReturn::StopIteration
1 parent ec18a12 commit 76ef074

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

vm/src/stdlib/itertools.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,13 @@ mod decl {
9696
}
9797
}
9898
};
99-
next.map_err(|err| {
100-
*zelf.source.write() = None;
101-
err
102-
})
99+
match next {
100+
Err(_) | Ok(PyIterReturn::StopIteration(_)) => {
101+
*zelf.source.write() = None;
102+
}
103+
_ => {}
104+
};
105+
next
103106
}
104107
}
105108

0 commit comments

Comments
 (0)