Jefffrey commented on PR #5566:
URL: https://github.com/apache/arrow-rs/pull/5566#issuecomment-2030502478

   > Thanks for this PR :)
   > 
   > Fyi, I pulled in this branch to update delta-rs (see 
[delta-io/delta-rs#2363](https://github.com/delta-io/delta-rs/issues/2363)). 
When `gil-refs` is enabled it compiles successfully, but when `gil-refs` is 
disabled I get a traits bounds error.
   > 
   > ```
   > error[E0277]: the trait bound `&str: PyClass` is not satisfied
   >     --> 
/Users/abhiagarwal/.cargo/git/checkouts/arrow-rs-d4122f2d122601f4/b1f5c49/arrow/src/pyarrow.rs:114:47
   >      |
   > 114  |         let expected_module = expected_module.extract::<&str>()?;
   >      |                                               ^^^^^^^ the trait 
`PyClass` is not implemented for `&str`, which is required by `&str: 
FromPyObjectBound<'_, '_>`
   >      |
   >      = help: the following other types implement trait 
`FromPyObjectBound<'a, 'py>`:
   >                Cow<'a, [u8]>
   >                Cow<'a, str>
   >                &'a [u8]
   >      = note: required for `&str` to implement `pyo3::FromPyObject<'_>`
   >      = note: required for `&str` to implement `FromPyObjectBound<'_, '_>`
   > note: required by a bound in `pyo3::prelude::PyAnyMethods::extract`
   >     --> 
/Users/abhiagarwal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.0/src/types/any.rs:1649:12
   >      |
   > 1647 |     fn extract<'a, T>(&'a self) -> PyResult<T>
   >      |        ------- required by a bound in this associated function
   > 1648 |     where
   > 1649 |         T: FromPyObjectBound<'a, 'py>;
   >      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in 
`PyAnyMethods::extract`
   > 
   > error[E0277]: the trait bound `&str: PyClass` is not satisfied
   >     --> 
/Users/abhiagarwal/.cargo/git/checkouts/arrow-rs-d4122f2d122601f4/b1f5c49/arrow/src/pyarrow.rs:116:43
   >      |
   > 116  |         let expected_name = expected_name.extract::<&str>()?;
   >      |                                           ^^^^^^^ the trait 
`PyClass` is not implemented for `&str`, which is required by `&str: 
FromPyObjectBound<'_, '_>`
   >      |
   >      = help: the following other types implement trait 
`FromPyObjectBound<'a, 'py>`:
   >                Cow<'a, [u8]>
   >                Cow<'a, str>
   >                &'a [u8]
   >      = note: required for `&str` to implement `pyo3::FromPyObject<'_>`
   >      = note: required for `&str` to implement `FromPyObjectBound<'_, '_>`
   > note: required by a bound in `pyo3::prelude::PyAnyMethods::extract`
   >     --> 
/Users/abhiagarwal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.0/src/types/any.rs:1649:12
   >      |
   > 1647 |     fn extract<'a, T>(&'a self) -> PyResult<T>
   >      |        ------- required by a bound in this associated function
   > 1648 |     where
   > 1649 |         T: FromPyObjectBound<'a, 'py>;
   >      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in 
`PyAnyMethods::extract`
   > 
   > error[E0277]: the trait bound `&str: PyClass` is not satisfied
   >     --> 
/Users/abhiagarwal/.cargo/git/checkouts/arrow-rs-d4122f2d122601f4/b1f5c49/arrow/src/pyarrow.rs:119:41
   >      |
   > 119  |         let found_module = found_module.extract::<&str>()?;
   >      |                                         ^^^^^^^ the trait `PyClass` 
is not implemented for `&str`, which is required by `&str: 
FromPyObjectBound<'_, '_>`
   >      |
   >      = help: the following other types implement trait 
`FromPyObjectBound<'a, 'py>`:
   >                Cow<'a, [u8]>
   >                Cow<'a, str>
   >                &'a [u8]
   >      = note: required for `&str` to implement `pyo3::FromPyObject<'_>`
   >      = note: required for `&str` to implement `FromPyObjectBound<'_, '_>`
   > note: required by a bound in `pyo3::prelude::PyAnyMethods::extract`
   >     --> 
/Users/abhiagarwal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.0/src/types/any.rs:1649:12
   >      |
   > 1647 |     fn extract<'a, T>(&'a self) -> PyResult<T>
   >      |        ------- required by a bound in this associated function
   > 1648 |     where
   > 1649 |         T: FromPyObjectBound<'a, 'py>;
   >      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in 
`PyAnyMethods::extract`
   > 
   > error[E0277]: the trait bound `&str: PyClass` is not satisfied
   >     --> 
/Users/abhiagarwal/.cargo/git/checkouts/arrow-rs-d4122f2d122601f4/b1f5c49/arrow/src/pyarrow.rs:121:37
   >      |
   > 121  |         let found_name = found_name.extract::<&str>()?;
   >      |                                     ^^^^^^^ the trait `PyClass` is 
not implemented for `&str`, which is required by `&str: FromPyObjectBound<'_, 
'_>`
   >      |
   >      = help: the following other types implement trait 
`FromPyObjectBound<'a, 'py>`:
   >                Cow<'a, [u8]>
   >                Cow<'a, str>
   >                &'a [u8]
   >      = note: required for `&str` to implement `pyo3::FromPyObject<'_>`
   >      = note: required for `&str` to implement `FromPyObjectBound<'_, '_>`
   > note: required by a bound in `pyo3::prelude::PyAnyMethods::extract`
   >     --> 
/Users/abhiagarwal/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.0/src/types/any.rs:1649:12
   >      |
   > 1647 |     fn extract<'a, T>(&'a self) -> PyResult<T>
   >      |        ------- required by a bound in this associated function
   > 1648 |     where
   > 1649 |         T: FromPyObjectBound<'a, 'py>;
   >      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in 
`PyAnyMethods::extract`
   > ```
   > 
   > The `FromPyObject` trait gets disabled without `gil-refs`, leading to the 
error. 
([source](https://github.com/PyO3/pyo3/blob/63ba371db021985e01818694cc0987ee213fd4b9/src/conversions/std/slice.rs#L21-L43))
 It should be able to be fixed by changing all the `extract` to `extract_bound` 
per the migration guide.
   
   Hmm, I'm a bit confused by this, as we don't have the `gil-refs` feature 
enabled and I don't think it's a default feature enabled by `pyo3` (even if it 
is, we disable the default-features). And the affected code seems to fall in 
line with what the migration guide suggests: 
https://pyo3.rs/v0.21.0/migration.html#deactivating-the-gil-refs-feature
   
   Am I missing something?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to