Description
I've taken a look at #613 (still open) but wanted to consolidate work around potentially adding support for free-threading to msgpack-python to a dedicated issue.
With the recent update to Cython 3.1.1, msgpack-python builds with 3.13t and passes all existing tests. However, there don't seem to be any existing tests for multithreading.
I added a multithreading test for packing to this fork, and get flakey results with segmentation fault errors:
test/test_multithreading.py::test_multithread_packing Fatal Python error: Segmentation fault
The standard TODOs for adding free-threading support are:
- Audit Python bindings and declare them free-threading compatible (xref https://py-free-threading.github.io/porting/#updating-extension-modules).
- Run the test suite with
pytest-run-parallel
to find potential issues, and fix them. - Run the test suite under ThreadSanitizer. If possible, depends on how many dependencies there are and if they run under TSan.
- Add
cp313t-*
to CI to build free-threading wheels.
For more details, please see the
suggested plan of attack in the py-free-threading guide.
Let me know if help is wanted to build out multithreading tests, like the one above, as well as to make the underlying code thread safe. Any suggestions here will be very useful.