From 2013cc9c3330bfdb18175d7115ed001f07a33464 Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Mon, 13 Jan 2025 19:33:01 +0100 Subject: [PATCH] Fix `future_into_py_futlike` on win --- src/runtime.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index 21d80f58..f5437fdd 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -202,7 +202,7 @@ where pub(crate) fn future_into_py_futlike(rt: R, py: Python, fut: F) -> PyResult> where R: Runtime + ContextExt + Clone, - F: Future> + Send + 'static, + F: Future + Send + 'static, { let event_loop = rt.py_event_loop(py); let event_loop_ref = event_loop.clone_ref(py); @@ -224,7 +224,8 @@ where result = fut => { let _ = rb.run(move || { Python::with_gil(|py| { - let (cb, value) = match result { + let pyres = result.into_pyobject(py).map(Bound::unbind); + let (cb, value) = match pyres { Ok(val) => (fut_ref.getattr(py, pyo3::intern!(py, "set_result")).unwrap(), val), Err(err) => (fut_ref.getattr(py, pyo3::intern!(py, "set_exception")).unwrap(), err.into_py_any(py).unwrap()) };