Closed minrk closed 2 months ago
As described in #40 https://github.com/python-cffi/cffi/issues/40 I we would be quite surprised if cffi is stable out of the box with the new free threading mode. This includes modules built with cffi. They may appear to work, but knowing the source code I am rather sure that you have just been lucky so far.
Feel free to make a branch or fork for the free threading mode. I'm not sure there is a point in adding a few easy fixes to the main branch if there isn't a will to see the rest of the project through and extensively test it.
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.
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...
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.
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: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)