Skip to content

Commit

Permalink
Hold GIL for drops on futures cancellation (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Jul 9, 2024
1 parent 1749141 commit 24db55e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ where
Python::with_gil(|_| drop(aw));
});
},
() = cancel_tx.notified() => {}
() = cancel_tx.notified() => {
let _ = rb.run(move || {
Python::with_gil(|_| drop(aw));
});
}
}
});

Expand Down Expand Up @@ -249,7 +253,14 @@ where
});
});
},
() = cancel_tx.notified() => {}
() = cancel_tx.notified() => {
let _ = rb.run(move || {
Python::with_gil(|py| {
drop(fut_ref);
drop(event_loop_ref);
});
});
}
}
});

Expand Down

0 comments on commit 24db55e

Please sign in to comment.