Skip to content

Support for free-threaded CPython #635

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

Closed
4 tasks
m-clare opened this issue May 28, 2025 · 0 comments
Closed
4 tasks

Support for free-threaded CPython #635

m-clare opened this issue May 28, 2025 · 0 comments

Comments

@m-clare
Copy link

m-clare commented May 28, 2025

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.

@m-clare m-clare closed this as completed May 28, 2025
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

No branches or pull requests

1 participant