Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,15 +596,11 @@ where
let future_tx1: Py<PyAny> = py_fut.clone().into();
let future_tx2 = future_tx1.clone_ref(py);

R::spawn(async move {
let locals2 = Python::attach(|py| locals.clone_ref(py));
let (locals2, locals3) = Python::attach(|py| (locals.clone_ref(py), locals.clone_ref(py)));

R::spawn(async move {
if let Err(e) = R::spawn(async move {
let result = R::scope(
Python::attach(|py| locals2.clone_ref(py)),
Cancellable::new_with_cancel_rx(fut, cancel_rx),
)
.await;
let result = R::scope(locals2, Cancellable::new_with_cancel_rx(fut, cancel_rx)).await;

Python::attach(move |py| {
if cancelled(future_tx1.bind(py))
Expand All @@ -615,7 +611,7 @@ where
}

let _ = set_result(
&locals2.event_loop(py),
&locals3.event_loop(py),
future_tx1.bind(py),
result.and_then(|val| val.into_py_any(py)),
)
Expand Down