Skip to content

Commit

Permalink
Always set result in PyFutureAwaitable
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed Jan 30, 2025
1 parent 73b5771 commit 338f813
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ impl PyFutureAwaitable {

pub(crate) fn set_result(pyself: Py<Self>, py: Python, result: FutureResultToPy) {
let rself = pyself.get();

_ = rself.result.set(result.into_pyobject(py).map(Bound::unbind));
if rself
.state
.compare_exchange(
Expand All @@ -584,7 +586,6 @@ impl PyFutureAwaitable {
return;
}

let _ = rself.result.set(result.into_pyobject(py).map(Bound::unbind));
let ack = rself.ack.read().unwrap();
if let Some((cb, ctx)) = &*ack {
let _ = rself.event_loop.clone_ref(py).call_method(
Expand Down

0 comments on commit 338f813

Please sign in to comment.