You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When building a brand new project created with maturin new, I see that error: failed to parse PyO3 config: Error { value: "expected key=value pair on line 7", source: None }.
After some investigations, I found out that from_cargo_dep_env() replaces every \\n with \n.
Note that lib_dir and executable now have wrong paths: C:\\Users\nobsclement\\AppData\\Local\\Programs\\Python\\Python39\\libs and D:\\code\nobody\\rust\\libs\\test_package\\.venv\\Scripts\\python.exe.
The bug occurs when the parse_value macro trims the line and interprets the path as two (or more) lines:
Source a venv in a path that contains a folder that starts with a lowercase n
Use maturin build
The build crashed when parsing lib_dir, but it should also crash when parsing executable which those steps should reproduce.
Backtrace
error: failed to run custom build commandfor`pyo3 v0.16.3`
Caused by:
process didn't exit successfully: `D:\code\nobody\rust\target\debug\build\pyo3-b6ef0b8efd5a0d05\build-script-build` (exit code: 101) --- stderr thread 'main' panicked at 'failed to parse PyO3 config: Error { value: "expected key=value pair on line 7", source: None }', C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\pyo3-build-config-0.16.3\src\lib.rs:94:10 stack backtrace: 0: std::panicking::begin_panic_handler at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs:584 1: core::panicking::panic_fmt at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\core\src\panicking.rs:143 2: core::result::unwrap_failed at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\core\src\result.rs:1749 3: enum$<core::result::Result<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::errors::Error> >::expect<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::errors::Error> at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\result.rs:1022 4: pyo3_build_config::get::closure$0 at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\pyo3-build-config-0.16.3\src\lib.rs:83 5: once_cell::sync::impl$6::get_or_init::closure$0<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::get::closure_env$0> at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\lib.rs:974 6: once_cell::imp::impl$4::initialize::closure$0<pyo3_build_config::impl_::InterpreterConfig,once_cell::sync::impl$6::get_or_init::closure_env$0<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::get::closure_env$0>,enum$<once_cell::sync::impl$6: at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\imp_std.rs:95 7: once_cell::imp::initialize_inner at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\imp_std.rs:171 8: once_cell::imp::OnceCell<pyo3_build_config::impl_::InterpreterConfig>::initialize<pyo3_build_config::impl_::InterpreterConfig,once_cell::sync::impl$6::get_or_init::closure_env$0<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::get::closure_e at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\imp_std.rs:93 9: once_cell::sync::OnceCell<pyo3_build_config::impl_::InterpreterConfig>::get_or_try_init<pyo3_build_config::impl_::InterpreterConfig,once_cell::sync::impl$6::get_or_init::closure_env$0<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::get::clo at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\lib.rs:1014 10: once_cell::sync::OnceCell<pyo3_build_config::impl_::InterpreterConfig>::get_or_init<pyo3_build_config::impl_::InterpreterConfig,pyo3_build_config::get::closure_env$0> at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\once_cell-1.10.0\src\lib.rs:974 11: pyo3_build_config::get at C:\Users\nobsclement\.cargo\registry\src\github.jparrowsec.cn-1ecc6299db9ec823\pyo3-build-config-0.16.3\src\lib.rs:75 12: build_script_build::configure_pyo3 at .\build.rs:43 13: build_script_build::main at .\build.rs:56 14: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> > at /rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\ops\function.rs:227 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.warning: build failed, waiting for other jobs to finish...
Your operating system and version
Windows 10, Version 2004
Your Python version (python --version)
Python 3.9.10
Your Rust version (rustc --version)
rustc 1.60.0 (7737e0b5c 2022-04-04)
Your PyO3 version
0.16.3
How did you install python? Did you use a virtualenv?
Python was installed using the python.org installer for windows.
I used a venv to build my project.
Additional Info
No response
The text was updated successfully, but these errors were encountered:
Bug Description
When building a brand new project created with
maturin new
, I see that error:failed to parse PyO3 config: Error { value: "expected key=value pair on line 7", source: None }
.After some investigations, I found out that
from_cargo_dep_env()
replaces every\\n
with\n
.pyo3/pyo3-build-config/src/impl_.rs
Line 369 in cb48557
Here is what
buf.as_str()
looks like before that replace is done:And after the replace:
Note that
lib_dir
andexecutable
now have wrong paths:C:\\Users\nobsclement\\AppData\\Local\\Programs\\Python\\Python39\\libs
andD:\\code\nobody\\rust\\libs\\test_package\\.venv\\Scripts\\python.exe
.The bug occurs when the
parse_value
macro trims the line and interprets the path as two (or more) lines:pyo3/pyo3-build-config/src/impl_.rs
Line 379 in cb48557
Steps to Reproduce
On windows:
maturin build
The build crashed when parsing
lib_dir
, but it should also crash when parsingexecutable
which those steps should reproduce.Backtrace
Your operating system and version
Windows 10, Version 2004
Your Python version (
python --version
)Python 3.9.10
Your Rust version (
rustc --version
)rustc 1.60.0 (7737e0b5c 2022-04-04)
Your PyO3 version
0.16.3
How did you install python? Did you use a virtualenv?
Python was installed using the python.org installer for windows.
I used a venv to build my project.
Additional Info
No response
The text was updated successfully, but these errors were encountered: