davidhewitt / pythonize

MIT License
198 stars 28 forks source link

Compilation error with pythonize 0.21 and pyo3 0.21.1 #59

Closed Tiwalun closed 5 months ago

Tiwalun commented 5 months ago

I've tried updating a private project to pyo3 0.21.1 and pythonize 0.21.0, but it fails to compile with the following issue:

error[E0599]: no method named `to_str` found for reference `&pyo3::Bound<'_, PyUnicode>` in the current scope
   --> /home/dobo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pythonize-0.21.0/src/de.rs:133:52
    |
133 |         let s = self.input.downcast::<PyString>()?.to_str()?;
    |                                                    ^^^^^^ help: there is a method with a similar name: `into_ptr`

error[E0599]: no method named `to_str` found for reference `&pyo3::Bound<'_, PyUnicode>` in the current scope
   --> /home/dobo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pythonize-0.21.0/src/de.rs:156:29
    |
156 |         visitor.visit_str(s.to_str()?)
    |                             ^^^^^^ help: there is a method with a similar name: `into_ptr`

error[E0599]: no method named `to_str` found for reference `&pyo3::Bound<'_, PyUnicode>` in the current scope
   --> /home/dobo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pythonize-0.21.0/src/de.rs:286:34
    |
286 |             visitor.visit_enum(s.to_str()?.into_deserializer())
    |                                  ^^^^^^ help: there is a method with a similar name: `into_ptr`

error[E0599]: no method named `to_str` found for reference `&pyo3::Bound<'_, PyUnicode>` in the current scope
   --> /home/dobo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pythonize-0.21.0/src/de.rs:300:29
    |
300 |         visitor.visit_str(s.to_str()?)
    |                             ^^^^^^ help: there is a method with a similar name: `into_ptr`

error[E0599]: no method named `to_str` found for struct `pyo3::Bound<'py, PyUnicode>` in the current scope
   --> /home/dobo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pythonize-0.21.0/src/de.rs:409:26
    |
409 |             self.variant.to_str()?.into_deserializer();
    |                          ^^^^^^ help: there is a method with a similar name: `into_ptr`

Any idea what could be going wrong here?

davidhewitt commented 5 months ago

Strange. I'll try to take a look later.

davidhewitt commented 5 months ago

Ah, you must be compiling for abi3 targeting a minimum version before 3.10. I'll fixup.