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

python -m maturin develop doesn't have non-zero exit code on Windows #2048

Closed
1 of 2 tasks
trim21 opened this issue Apr 19, 2024 · 6 comments · Fixed by #2055
Closed
1 of 2 tasks

python -m maturin develop doesn't have non-zero exit code on Windows #2048

trim21 opened this issue Apr 19, 2024 · 6 comments · Fixed by #2055
Labels
bug Something isn't working

Comments

@trim21
Copy link
Contributor

trim21 commented Apr 19, 2024

Bug Description

I'm using python -m maturin to run maturin, but when maturin develop exit with code 1, python -m maturin develop always exit with code 0.

Your maturin version (maturin --version)

maturin 1.5.1

Your Python version (python -V)

Python 3.11.9

Your pip version (pip -V)

pip 24.0

What bindings you're using

None

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

create repo

make repo unbuildable, for example syntax error in lib.rs

run `python -m

@trim21 trim21 added the bug Something isn't working label Apr 19, 2024
@messense
Copy link
Member

I'm unable to reproduce this on macOS.

$ python -m maturin develop
    Updating crates.io index
🔗 Found pyo3 bindings
🐍 Found CPython 3.12 at /Users/messense/.pyenv/versions/3.12.0/envs/test/bin/python
📡 Using build options features from pyproject.toml
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
   Compiling target-lexicon v0.12.14
   Compiling once_cell v1.19.0
   Compiling autocfg v1.2.0
   Compiling proc-macro2 v1.0.81
   Compiling unicode-ident v1.0.12
   Compiling libc v0.2.153
   Compiling parking_lot_core v0.9.9
   Compiling portable-atomic v1.6.0
   Compiling heck v0.4.1
   Compiling scopeguard v1.2.0
   Compiling smallvec v1.13.2
   Compiling cfg-if v1.0.0
   Compiling unindent v0.2.3
   Compiling indoc v2.0.5
   Compiling lock_api v0.4.11
   Compiling memoffset v0.9.1
   Compiling pyo3-build-config v0.20.3
   Compiling quote v1.0.36
   Compiling syn v2.0.60
   Compiling parking_lot v0.12.1
   Compiling pyo3-ffi v0.20.3
   Compiling pyo3 v0.20.3
   Compiling pyo3-macros-backend v0.20.3
   Compiling pyo3-macros v0.20.3
   Compiling hello v0.1.0 (/Users/messense/Projects/maturin/hello)
error[E0308]: mismatched types
 --> src/lib.rs:5:41
  |
5 | fn sum_as_string(a: usize, b: usize) -> PyResult<String> {}
  |    -------------                        ^^^^^^^^^^^^^^^^ expected `Result<String, PyErr>`, found `()`
  |    |
  |    implicitly returns `()` as its body has no tail or `return` expression
  |
  = note:   expected enum `Result<String, PyErr>`
          found unit type `()`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `hello` (lib) due to 1 previous error
💥 maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO PYO3_ENVIRONMENT_SIGNATURE="cpython-3.12-64bit" PYO3_PYTHON="/Users/messense/.pyenv/versions/3.12.0/envs/test/bin/python" PYTHON_SYS_EXECUTABLE="/Users/messense/.pyenv/versions/3.12.0/envs/test/bin/python" "cargo" "rustc" "--features" "pyo3/extension-module" "--message-format" "json-render-diagnostics" "--manifest-path" "/Users/messense/Projects/maturin/hello/Cargo.toml" "--lib" "--" "-C" "link-arg=-undefined" "-C" "link-arg=dynamic_lookup" "-C" "link-args=-Wl,-install_name,@rpath/hello.cpython-312-darwin.so"`

$ echo $?
1

@messense
Copy link
Member

We are using os.execv to replace python -m maturin process with maturin so it's unlikely the exit code will differ.

@messense messense closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@trim21
Copy link
Contributor Author

trim21 commented Apr 22, 2024

(.venv) ❯❯ ~\..\bencode2 git:(perf) python -m maturin q
(.venv) error: unrecognized subcommand 'q'

Usage: maturin <COMMAND>

For more information, try '--help'.
❯❯ ~\..\bencode2 git:(perf) echo $LastExitCode
0
(.venv) ❯❯ ~\..\bencode2 git:(perf) maturin q
error: unrecognized subcommand 'q'

Usage: maturin.exe <COMMAND>

For more information, try '--help'.
(.venv) ❯❯ ~\..\bencode2 git:(perf) echo $LastExitCode
2
(.venv) ❯❯ ~\..\bencode2 git:(perf)

@trim21
Copy link
Contributor Author

trim21 commented Apr 22, 2024

We are using os.execv to replace python -m maturin process with maturin so it's unlikely the exit code will differ.

it's a cpython bug on windows

python/cpython#63323

@messense
Copy link
Member

I don't have a windows machine near me, so pull requests are welcome if you want to contribute a fix for Windows.

@messense messense reopened this Apr 22, 2024
@messense messense changed the title python -m maturin develop doesn't have non-zero exit code python -m maturin develop doesn't have non-zero exit code on Windows Apr 22, 2024
@messense
Copy link
Member

I've changed the title to reflect the fact it's a Windows specific issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants