GeezerVison is showing github.com — Add support for free-threaded Python · Issue #225 · python-rapidjson/python-rapidjson
Add support for free-threaded Python #225DescriptionWith free-threaded Python shortly leaving the experimental stage (with 3.14) would be nice to have wheels published for 3.13t and 3.14t variants. Activitylelit commented on Jul 31, 2025 To be honest, while I have read announcements and the like about FT, I don't know what changes on a C++ extension would be required: I doubt it's just a matter of recompiling against a different variant of the interpreter.
So, first step would be to collect some specific info, or even examples of some project that already did that. gi0baro commented on Jul 31, 2025
So, first step would be to collect some specific info, or even examples of some project that already did that.
I maintain some Rust based extensions for Python, and in my experience the steps involved usually are:
- check the extension code is sound and thread-safe
- patch/refactor code that doesn't comply with point 1
- declare in the extension module(s) the free-threaded support
- compile the wheel against the different interpreter variants
I'd say the free-threading guide has some very-well written details about the whole process. lelit commented on Aug 3, 2025 Thank you Giovanni, I read that guide (actually re-read, but now with a particular goal in mind 😉).
I have upgraded the cibuildwheel used on GH Actions to build wheels and run the tests on supported snakes, so I'm going to try to enable the free threaded variant of Python 3.14.
I wonder if you could provide a simple-but-not-trivial test case to exercise the library with more than one thread, or point me in the right direction? gi0baro commented on Aug 10, 2025 hey @lelit, sorry for the late reply.
I guess I don't have any particular suggestions in terms of testing, other than wrapping lib calls in a function and spawning 2 or more threading.Thread(target=yourfunction). I'd say it also really depends on how your tests are designed. lelit commented on Aug 22, 2025 I spent some time playing with this, and pushed some related commits in the free-threaded branch: note that that is just an experiment right now, and it surely need some more competent eye than mine to assert it is sensible.
That said, I manually installed the pytest-freethreaded plugin, and followed the suggested phases in its README: I've got some crashes in the tests that are using either the tracemalloc library or the sys.getrecursionlimit() function, but skipping those tests under the "no-GIL" variant, everything seems working.
I still have no clue at all whether that tells something positive or not.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|