-
Notifications
You must be signed in to change notification settings - Fork 913
Open
Description
The following code fails to compile:
#[pyfunction]
async fn none(py: Python<'_>) -> Bound<'_, PyAny> {
py.None().into_bound(py)
}The error message is:
error[E0521]: borrowed data escapes outside of function
--> src/lib.rs:7:5
|
7 | #[pyfunction]
| ^^^^^^^^^^^^^
| |
| `py` is a reference that is only valid in the function body
| `py` escapes the function body here
| lifetime `'py` defined here
| argument requires that `'py` must outlive `'static`
|
= note: this error originates in the attribute macro `pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info)
error: future cannot be sent between threads safely
--> src/lib.rs:7:5
|
7 | #[pyfunction]
| ^^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: within `{async block@src/lib.rs:7:5: 7:18}`, the trait `Send` is not implemented for `*mut pyo3::Python<'static>`
Metadata
Metadata
Assignees
Labels
No labels