You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
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.
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.
Activity
lelit commentedon 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 commentedon Jul 31, 2025
I maintain some Rust based extensions for Python, and in my experience the steps involved usually are:
I'd say the free-threading guide has some very-well written details about the whole process.
lelit commentedon 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
cibuildwheelused 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 commentedon 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 commentedon 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 thetracemalloclibrary or thesys.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.