PyO3 / pyo3

Rust bindings for the Python interpreter
https://pyo3.rs
Apache License 2.0
12.41k stars 766 forks source link

Free-threaded build config fixes #4719

Open ngoldbaum opened 4 days ago

ngoldbaum commented 4 days ago

Fixes #4709.

Trying to get a library name or build pyo3-ffi against a free-threaded ABI for Python earlier than 3.13 now panics.

Also adds tests for the panics and for the free-threaded library names as followup for #4690 where I ran out of steam to add new tests.

While working on this I noticed that there was code to work around https://github.com/python/cpython/issues/101614 which was fixed in CPython for 3.10 and newer, so I modified the workaround code path to only apply for Python 3.9 and older.

davidhewitt commented 3 days ago

👍 thanks, do you want me to review before the above comments are resolved?

ngoldbaum commented 3 days ago

Go ahead.

Tiny bit of context: I often look at PRs on my phone since it helps me catch things if I look over code in a different context from where I wrote it.

davidhewitt commented 7 hours ago

See also https://github.com/PyO3/maturin/pull/2310#issuecomment-2494026889, can probably adjust here.

ngoldbaum commented 2 hours ago

Along with some changes to maturin on top of https://github.com/PyO3/maturin/pull/2310 (which I'll create a separate PR for) this latest push lets more of the maturin tests pass on my local dev setup.