-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bindings/python: Bump PyO3 to 0.21 #4399
Comments
I'd like to take a look. |
Get an error if update pyo3 to |
Seems we can write Would you like to give it a try? I'm guessing we can remove |
Yep, let me take a look. 😉 |
Based on the previous discussion, I took the following action:
Do we wait for the next release or just depend on the commit included this patch? |
I think we need to wait for the next release. From the PyO3 release history timeline, we do not need to wait for the long time. |
@reswqa Good news, https://github.com/PyO3/pyo3/releases/tag/v0.21.1 pyo3 minor release includes your change! |
Yes, but my implementation seems to have some problems (which have been fixed), and 0.21.1 also has a serious blocker that won't compile in some case, |
|
@Xuanwo Yes, but I'm getting married and will on my honeymoon recently though 💒 :) so I can't put in the time right away. 😉 NB. If others are interested, feel free to take over this. If no one beats me, I'll keep doing it when I come back. |
Wow, congrats! Please enjoy your time 💌
Never mind, there is no hurry. |
I tried to bump to 0.21 but met many issues... I pushed my local changes to https://github.com/apache/opendal/tree/bump-to-0.21 error: future cannot be sent between threads safely
--> src/file.rs:311:1
|
311 | #[pymethods]
| ^^^^^^^^^^^^ future created by async block is not `Send`
|
= help: within `pyo3::PyAny`, the trait `Sync` is not implemented for `UnsafeCell<pyo3::ffi::PyObject>`, which is required by `{async block@src/file.rs:311:1: 311:13}: std::marker::Send`
note: captured value is not `Send` because `&` references cannot be sent unless their referent is `Sync`
--> src/file.rs:311:1
|
311 | #[pymethods]
| ^^^^^^^^^^^^ has type `&pyo3::PyAny` which is not `Send`, because `pyo3::PyAny` is not `Sync`
note: required by a bound in `new_coroutine`
--> /home/xuanwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.2/src/impl_/coroutine.rs:22:40
|
15 | pub fn new_coroutine<F, T, E>(
| ------------- required by a bound in this function
...
22 | F: Future<Output = Result<T, E>> + Send + 'static,
| ^^^^ required by this bound in `new_coroutine`
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `impl futures::Future<Output = Result<bool, pyo3::PyErr>>: IntoPyCallbackOutput<_>` is not satisfied
--> src/file.rs:311:1
|
311 | #[pymethods]
| ^^^^^^^^^^^^ the trait `IntoPyCallbackOutput<_>` is not implemented for `impl futures::Future<Output = Result<bool, pyo3::PyErr>>`
|
= help: the following other types implement trait `IntoPyCallbackOutput<Target>`:
<bool as IntoPyCallbackOutput<bool>>
<bool as IntoPyCallbackOutput<i32>>
<usize as IntoPyCallbackOutput<isize>>
<usize as IntoPyCallbackOutput<usize>>
<HashCallbackOutput as IntoPyCallbackOutput<isize>>
<IterNextOutput<T, U> as IntoPyCallbackOutput<*mut pyo3::ffi::PyObject>>
<IterANextOutput<T, U> as IntoPyCallbackOutput<*mut pyo3::ffi::PyObject>>
<Result<T, E> as IntoPyCallbackOutput<U>>
and 3 others
note: required by a bound in `pyo3::callback::convert`
--> /home/xuanwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.2/src/callback.rs:170:8
|
168 | pub fn convert<T, U>(py: Python<'_>, value: T) -> PyResult<U>
| ------- required by a bound in this function
169 | where
170 | T: IntoPyCallbackOutput<U>,
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `convert`
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info) |
Hi @Xuanwo. Yes, I feel like the pyo3's bulit-in supports for async-io is not yet mature. I have filed a PR that still use |
PyO3 has been released, we can bump pyo3 to 0.21 now.
Update pyo3 in https://github.com/apache/opendal/blob/main/bindings/python/Cargo.toml and address possible build failure and warnings.
The text was updated successfully, but these errors were encountered: