'pyo3' is in scope, but it is a crate, not an attribute
when used with cfg_attr()
#5125
Labels
'pyo3' is in scope, but it is a crate, not an attribute
when used with cfg_attr()
#5125
Bug Description
Cargo.toml
src/main.rs
working
failing
Steps to Reproduce
Copy files above locally. Build with
--features py-bindings,fail
.Backtrace
Your operating system and version
Ubuntu 22.04.5 LTS
Your Python version (
python --version
)Python 3.12.7 (main, Nov 20 2024, 20:26:30) [GCC 11.4.0] (local pyenv build)
Your Rust version (
rustc --version
)rustc 1.86.0 (05f9846f8 2025-03-31)
Your PyO3 version
0.24.2
How did you install python? Did you use a virtualenv?
Python was built with pyenv. I normally do work in virtualenvs but did not create one for this report.
Additional Info
I have worked around this by duplicating code guarded by
#[cfg(feature = "py-bindings")]
and#[cfg(not(feature = "py-bindings"))]
.The text was updated successfully, but these errors were encountered: