MAINT: Pin Cython to <3.3 - #32393
eendebakpt wants to merge 3 commits into
Conversation
Cython 3.3.0 changed the limited-API CyFunction layout per abi3 target without updating the shared-type ABI key, so importing extensions built for different targets fails with "Shared Cython type cython_function_or_method has the wrong size". This breaks test_limited_api on all platforms. See cython/cython#7914. Co-Authored-By: Claude Fable 5 <[email protected]>
The limited-API Cython tests compile extensions at test time with the Cython installed via test_requirements.txt, so the pin is needed there too. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Thanks! And thanks also for reporting this upstream. I think we need to pin I'll merge this as soon as CI clears. |
|
I'm not sure if this is the correct fix. The upstream bug report isn't entirely clear, but the problem only occurs when multiple modules inside the same package have different targets, right? If so, that's a corner case that shouldn't occur in the real world, and the better fix is to disable the test until it's addressed in Cython 3.3.x |
| requires = [ | ||
| "meson-python>=0.20.0", | ||
| "Cython>=3.1.0", # keep in sync with version check in meson.build | ||
| "Cython>=3.1.0,<3.3", # keep in sync with version check in meson.build |
There was a problem hiding this comment.
This is definitely not necessary, even if the pin in the test requirements is the right call. numpy itself does not use the limited API.
Yeah, you're right. Sorry for not thinking this through carefully. I opened #32407. |
|
A verification and confirmation that it indeed does not happen if the extension modules with different minimum Python versions live in different packages (or don't share a shared utility library?) would be useful. If so, the upstream issue might be invalid or closeable with a doc-only update. It's still not entirely clear to me - the test is obscure. |
|
#32407 was merged so this one can be closed. Thanks Ralf for reminding me that upper version pins are bad (most of the time). |
I'm fairly sure it will happen with Cython modules in different packages. |
|
Okay, thanks for confirming. I still didn't understand why, so I dug a bit - see cython/cython#7914 (comment). |
PR summary
Cython 3.3.0 changed the limited-API CyFunction layout per abi3 target without updating the shared-type ABI key, so importing extensions built for different targets fails with "Shared Cython type cython_function_or_method has the wrong size". This breaks
test_limited_api. Upstream report is cython/cython#7914.AI Disclosure
Claude was used to investigate the issue.