Support Python 3.13 free-threaded build
ngoldbaum opened this issue · 3 comments
Is your feature request related to a problem? Please describe.
It looks like everything is mostly working on the free-threaded build, except for three failing tests:
=========================== short test summary info ============================
FAILED tests/test_blackd.py::BlackDTestCase::test_normalizes_line_endings - AssertionError: '[Errno 24] Too many open files' != 'c\r\nc\r\n'
FAILED tests/test_blackd.py::BlackDTestCase::test_preserves_line_endings - OSError: [Errno 24] Too many open files
FAILED tests/test_blackd.py::BlackDTestCase::test_single_character - OSError: [Errno 24] Too many open files
================== 3 failed, 372 passed, 3 skipped in 32.93s ===================
This is with a version of black I built using the free-threaded build of Python3.13.0rc1. I ran the tests with PYTHON_GIL=0
to force the GIL to be disabled. I also built aiohttp with an updated version of cython (see aio-libs/aiohttp#8796).
You should be able to follow https://py-free-threading.github.io/porting/ to declare that C extensions support running without the GIL, assuming there are no known or suspected thread safety issues.
Describe the solution you'd like
Supporting free-threaded Python without any special hacking.
Our C extension is built with mypyc, so I'd prefer a solution inside mypyc rather than something special we do ourselves.
Until mypyc supports free-threading, users using free-threading should be able to use our pure-Python wheel; I don't think mypyc even supports 3.13 with the GIL yet.
Also, the tests you flag depend on aiohttp; I wonder if the failures are because aiohttp doesn't support free-threading yet.
I see 3.13 support is being tracked over at mypyc/mypyc#1056.