You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
F: Future<Output = PyResult> + Send + 'static,
| ---- required by this bound in pyo3_asyncio::tokio::into_coroutine
|
= help: within PyDateTime, the trait Sync is not implemented for UnsafeCell<pyo3::ffi::PyObject>
Can values that are not send be wrapped in Arc or something.
What is the usual way of dealing with that.
The text was updated successfully, but these errors were encountered:
Actually I converted it to a DateTime outside the into_coroutine which solves the issue.
I guess there may be times where that won't do so original question may stand.
You might get this error when your future is capturing a reference to a PyO3 object like &PyDateTime when the real issue is that the future will not be able to capture that reference due to lifetime issues. Usually, the best thing to do is convert that &PyDateTime into a Py<PyDateTime> so it can be passed around like an Arc with the `'static' lifetime.
If that doesn't fix your Send issues, there are !Send variants of into_coroutine called local_future_into_py although they do have some caveats mentioned in this thread #23.
If I have a pyfunction like
that calls into_coroutine for a async block I get
F: Future<Output = PyResult> + Send + 'static,
| ---- required by this bound in
pyo3_asyncio::tokio::into_coroutine
|
= help: within
PyDateTime
, the traitSync
is not implemented forUnsafeCell<pyo3::ffi::PyObject>
Can values that are not send be wrapped in Arc or something.
What is the usual way of dealing with that.
The text was updated successfully, but these errors were encountered: