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
py_fn! currently requires a Python parameter, meaning that the GIL is always held when the function body is entered.
It would be very neat to not require this parameter, and when it was not included, release the GIL after preparing the arguments of the function and before calling it.
Concretely, this would reduce the boilerplate of "doing the right thing" (not holding the GIL through native code unless necessary) from:
fn my_function(py: Python, argument: String) -> Result<..> {
py.allow_threads(|| {
// do something with `argument`
..
})
}
...to:
fn my_function(argument: String) -> Result<..> {
// do something with `argument`
..
}
The text was updated successfully, but these errors were encountered:
py_fn! currently requires a
Python
parameter, meaning that the GIL is always held when the function body is entered.It would be very neat to not require this parameter, and when it was not included, release the GIL after preparing the arguments of the function and before calling it.
Concretely, this would reduce the boilerplate of "doing the right thing" (not holding the GIL through native code unless necessary) from:
...to:
The text was updated successfully, but these errors were encountered: