fix 3.15+ append_to_inittab on platforms which aren't 64-bit little-endian#6150
fix 3.15+ append_to_inittab on platforms which aren't 64-bit little-endian#6150davidhewitt wants to merge 4 commits into
append_to_inittab on platforms which aren't 64-bit little-endian#6150Conversation
|
cc @decathorpe, do you happen to have a way to test with this patch to confirm? I would also love if you have any ideas how we could test for 32-bit platform and/or s390x on CI; at the moment we run clippy for a bunch of platforms but I think you've hit a number of bugs on these platforms now. Hugely appreciate the patient reports but also feel like maybe it's time we considered if there's anything else we can do here to minimise the amount of issues which make it downstream to you. |
|
@davidhewitt I think QEMU can emulate both of those platforms. I have not tried using QEMU in a gtihub action runner, but it should work. So in CI, you can cross-compile and then run the test binary with QEMU. |
|
For 32-bit, it's possible to run a 32-bit Python binary on GHA Window. It's slow, though not as slow as emulation. |
Yes, I can. I've launched a test build with this PR included, I will report back once I get the results.
Yeah I think emulation is going to be the only workable solution here - Cirrus CI used to provide more architectures I think, but that's no longer an option.
Relatedly, depending on what test coverage you'd want, I think you'd also need to compile on the target platform, not cross-compile. Last time I checked, doctests did not support getting cross-compiled, so without compiling on the target platform, those wouldn't be covered by tests. |
|
Seems like the patch from this PR doesn't apply cleanly on top of 0.29.0, I'm getting compilation failures: I will try to test this PR directly instead of applying it as a patch on top of 0.29.0. EDIT: Nevermind, looks like the new code on the branch linked to this PR just doesn't compile. |
|
Sorry about that, the follow-up commit should hopefully fix the build. Regarding platform testing, we actually already have a 32-bit windows build but only for latest stable Python. I guess we could add a test for in-development Python, though I'm about too many platforms for in-development Python(s) creating unneeded churn. Probably at beta stage it's fine? I guess we need to make a similar decision for s390x, but it'd be even worse with QEMU emulation probably needing to build the in-dev Python version. |
Merging this PR will degrade performance by 26.2%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | into_u128_u64_max |
1.5 µs | 2 µs | -26.2% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing davidhewitt:pep-489-slots (b41e08b) with main (b3aa7da)
|
Thanks - I can confirm that with the changes in this PR, pyo3 v0.29.0 now compiles + runs tests successfully on both i686 and s390x (and doesn't regress the others). |
|
Great, thanks! |
ngoldbaum
left a comment
There was a problem hiding this comment.
Just one comment, otherwise this looks good.
For what it's worth, NumPy also recently switched our win32 CI job to run on 3.15t and it's been fine so far.
| /// | ||
| /// These are still needed on 3.15+ for `append_to_inittab` and for as long as | ||
| /// we continue to emit `PyInit_<name>` entry points on 3.15+. | ||
| pep_489_slots: UnsafeCell<[ffi::PyModuleDef_Slot; MAX_SLOTS_WITH_TRAILING_NULL]>, |
There was a problem hiding this comment.
Can these variables have names that don't refer to PEPs? Using more descriptive names avoids the need to look up the PEPs unless someone really needs to.
Fixes #6143
On 3.15,
m_slots: slots.0.get() as _was hiding a cast from*mut [PySlot; N]to*mut PyModuleDef_Slot. On 64-bit little-endian this happens to be ok, which is why we never noticed.