-
I'm sorry, I'm new to pyo3. Can anyone help me how to pass #[pyclass]
pub struct MyClass {}
#[pyfunction]
async fn foo(c: PyRefMut<MyClass>)->PyResult<()>{
Ok(())
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
Take both let c = c.borrow_mut(py); directly, i.e. call |
Beta Was this translation helpful? Give feedback.
-
The error is caused by a documented restriction. |
Beta Was this translation helpful? Give feedback.
The error is caused by a documented restriction.
The solution is also documented: you have to call
Python::with_gil
yourself, and it will have a negligible cost.