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

Fix compilation with CPython 3.12a6 #5339

Merged
merged 1 commit into from
Mar 28, 2023
Merged

Conversation

dnicolodi
Copy link
Contributor

CPython 3.12a6 made PyThreadState an opaque structure thus the fast thread state optimization cannot be employed anymore.

Fixes #5286.

CPython 3.12a6 made PyThreadState an opaque structure thus the fast
thread state optimization cannot be employed anymore.

Fixes cython#5286.
@scoder
Copy link
Contributor

scoder commented Mar 28, 2023

That's what we did in 0.29.x. However, for 3.0, I'd rather have a more efficient solution.

@scoder
Copy link
Contributor

scoder commented Mar 28, 2023

That said, we can still disable it until we have a better solution. That unblocks users who want to test with Py3.12.

@scoder scoder added this to the 3.0 milestone Mar 28, 2023
@scoder scoder merged commit d8251f8 into cython:master Mar 28, 2023
@scoder
Copy link
Contributor

scoder commented Mar 28, 2023

Thanks

@dnicolodi
Copy link
Contributor Author

dnicolodi commented Mar 28, 2023

Thanks @scoder I haven't recently tried the 0.29.x branch tip, but till recently 0.29 did not work on CPython 3.12: some fixes present only on master were necessary. Now I see that the equivalent of this fix was applied to the 0.29.x branch over a year ago bbac8b5. It seems that the CPython compatibility state of the two branches diverged a bit over time.

I would be happy to work on the better solution, but I'm not sure about what kind of dirty tricks is allowed to play in Cython to get access to the CPython internals. I can have a look at this if you point me to some "prior art" in this domain.

@dnicolodi
Copy link
Contributor Author

dnicolodi commented Mar 28, 2023

One more thing: it seems that CI was passing on CPython 3.12a6 without this patch. Do the tests need to be tightened up somehow to catch this kind of issues? Without this patch the compilation of very simple code fails for me.

@da-woods
Copy link
Contributor

One more thing: it seems that CI was passing on CPython 3.12a6 without this patch. Do the tests need to be tightened up somehow to catch this kind of issues? Without this patch the compilation of very simple code fails for me.

3.12 is deliberately set as an allowed failure until it's released (so looks like it passed). The tests will almost certainly not be passing if you look in more details. We expect it to get broken multiple times before release and don't really want that to block things like the recent Cython beta release

@scoder
Copy link
Contributor

scoder commented Mar 29, 2023

It seems that the CPython compatibility state of the two branches diverged a bit over time.

In the sense that 0.29.x is the legacy, boring, conservative branch where we avoid changes if possible and prefer disabling optimisations over risking breakage of existing code or requiring new releases all the time. 3.0 has a different goal where we try to improve the performance and adapt to changes in CPython.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Fast thread state access is broken by Py3.12a6
3 participants