Skip to content
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

LexError when upgrading from 0.21 to 0.22 #4352

Closed
TyberiusPrime opened this issue Jul 15, 2024 · 2 comments · Fixed by #4353
Closed

LexError when upgrading from 0.21 to 0.22 #4352

TyberiusPrime opened this issue Jul 15, 2024 · 2 comments · Fixed by #4353
Labels

Comments

@TyberiusPrime
Copy link

TyberiusPrime commented Jul 15, 2024

Bug Description

I'm using pyo3's #[pyclass] #[pymodule] etc to export a very limited number of items, and when trying to ugprade to 0.22 I receive error messages like

--> src/lib.rs:478:1
    |
478 | #[pymethods]
    | ^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

Steps to Reproduce

  1. git clone https://github.com/TyberiusPrime/pypipegraph2
  2. sed -i s/0.21/0.22/ Cargo.toml
  3. cargo check

Backtrace

argo check
    Updating crates.io index
    Checking once_cell v1.16.0
   Compiling pyo3-build-config v0.22.1
   Compiling pyo3-ffi v0.22.1
   Compiling pyo3-macros-backend v0.22.1
   Compiling pyo3 v0.22.1
   Compiling pyo3-macros v0.22.1
    Checking pypipegraph2 v3.0.9 (/home/finkernagel/upstream/ppg2_rust)
error: custom attribute panicked
   --> src/lib.rs:467:1
    |
467 | #[pyclass(name = "PPG2Evaluator")]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

error: custom attribute panicked
   --> src/lib.rs:478:1
    |
478 | #[pymethods]
    | ^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

error: custom attribute panicked
   --> src/lib.rs:601:1
    |
601 | #[pyfunction]
    | ^^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

error: custom attribute panicked
   --> src/lib.rs:608:1
    |
608 | #[pyfunction]
    | ^^^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

error: custom attribute panicked
   --> src/lib.rs:616:1
    |
616 | #[pymodule]
    | ^^^^^^^^^^^
    |
    = help: message: called `Result::unwrap()` on an `Err` value: LexError

warning: unused imports: `PyKeyError`, `PyTypeError`
 --> src/lib.rs:4:24
  |
4 | use pyo3::exceptions::{PyKeyError, PyTypeError, PyValueError};
  |                        ^^^^^^^^^^  ^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `pyo3::types::PyDict`
 --> src/lib.rs:5:5
  |
5 | use pyo3::types::PyDict;
  |     ^^^^^^^^^^^^^^^^^^^

warning: `pypipegraph2` (lib) generated 2 warnings
error: could not compile `pypipegraph2` (lib) due to 5 previous errors; 2 warnings emitted

Your operating system and version

nixos 24.05

Your Python version (python --version)

3.11.9

Your Rust version (rustc --version)

1.78.0

Your PyO3 version

0.22.2

How did you install python? Did you use a virtualenv?

nix flake

Additional Info

No response

@birkenfeld
Copy link
Member

Can reproduce, it's gone with 1.79.0 though.

@Icxolu
Copy link
Contributor

Icxolu commented Jul 15, 2024

This seems to origin from the c-string literals (#4269)

It seems that proc-macro only supports c-string literal from 1.79 (1) and proc-macro2 will try to use a fallback for these until 1.79 (2, 3), which seems to fail for some reason.

So we should probably bump our c_str_lit to only emit on 1.79 and later as well.

github-merge-queue bot pushed a commit that referenced this issue Jul 15, 2024
* only emit c-string literals on Rust 1.79 and later (#4352)

* add newsfragment
davidhewitt pushed a commit that referenced this issue Jul 16, 2024
* only emit c-string literals on Rust 1.79 and later (#4352)

* add newsfragment
davidhewitt pushed a commit that referenced this issue Jul 16, 2024
* only emit c-string literals on Rust 1.79 and later (#4352)

* add newsfragment
davidhewitt pushed a commit that referenced this issue Jul 17, 2024
* only emit c-string literals on Rust 1.79 and later (#4352)

* add newsfragment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants