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

limited api is not available in free-threaded cpython #104

Closed
wants to merge 1 commit into from

Conversation

minrk
Copy link
Contributor

@minrk minrk commented Aug 1, 2024

related to #40

Free-threaded builds don't support py_limited_api. Even setting py_limited_api=False still defines py_limited_api unless _CFFI_NO_LIMITED_API is also defined (fixed here), so compilation would still fail with:

$PREFIX/include/python3.13t/Python.h:51:4: error: "The limited API is not currently supported in the free-threaded build"
#  error "The limited API is not currently supported in the free-threaded build"

Perhaps it is also bug that set_source(py_limited_api=False) still creates a source that defines Py_LIMITED_API on most systems?

(this is by no means "free-threaded support" for cffi, but one small step required to build cffi extensions at all on free-threaded cpython)

@arigo
Copy link
Contributor

arigo commented Aug 1, 2024 via email

@arigo
Copy link
Contributor

arigo commented Aug 1, 2024 via email

@minrk
Copy link
Contributor Author

minrk commented Aug 1, 2024

Sure. If you don't think it worth doing anything except fixing everything all in one PR, feel free to close, because that's not something I can tackle. Disabling py_limited_api is just required to even start exploring issues with cffi, and this is the only condition that seems to govern it.

Is the fact that py_limited_api=False doesn't actually disable the limited api a bug? I don't know enough to be sure.

@arigo
Copy link
Contributor

arigo commented Aug 1, 2024

It certainly sounds strange. But keyword arguments are passed straight to the underlying distutils/setuptools, so I don't actually know either. As far as I know, py_limited_api wasn't even a valid keyword at the time the cffi code was written... Feel free to add it as its own bug report? I guess fixing that issue would also reduce the need for this PR for now...

@minrk
Copy link
Contributor Author

minrk commented Aug 2, 2024

CFFI has documentation about supporting py_limited_api=False, which is what I tried first, before arriving at this PR when I discovered the documented argument has no actual effect. There's no real need for this PR (even though I still think it's correct) after #106, since packages can start experimenting.

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

Successfully merging this pull request may close these issues.

3 participants