We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42d2d50 commit 090ebddCopy full SHA for 090ebdd
src/generic.rs
@@ -257,9 +257,11 @@ where
257
Ok(fut) => match fut.await {
258
Ok(item) => Ok(item),
259
Err(e) => {
260
- if Python::with_gil(|py| {
+ let stop_iter = Python::with_gil(|py| {
261
e.is_instance::<pyo3::exceptions::PyStopAsyncIteration>(py)
262
- }) {
+ });
263
+
264
+ if stop_iter {
265
// end the iteration
266
break;
267
} else {
@@ -270,7 +272,7 @@ where
270
272
Err(e) => Err(e),
271
273
};
274
- if let Err(_) = tx.send(item).await {
275
+ if tx.send(item).await.is_err() {
276
// receiving side was dropped
277
278
}
0 commit comments