scs-python icon indicating copy to clipboard operation
scs-python copied to clipboard

ENH: Free threading support

Open HaoZeke opened this issue 7 months ago • 2 comments

Closes #130.

Local tests via:

uv venv --python 3.13t .ftci
source .ftci/bin/activate
uv pip install numpy scipy pytest-timeout pytest-durations pytest-run-parallel
uv pip install -v .
uv run --no-project python -m pytest --parallel-threads=2 --iterations=2 -v -s --timeout=600 --durations=10 -m "not thread_unsafe" test

Basically follows the porting extensions advice:

  • Vendored pythoncapi-compat
  • Didn't rework Get* calls to use Get*Ref here since they're uses of argument parsing (xref C-API documentation)
  • Locks access to the C library, using an instance lock and a global lock (for memory allocations)

EDIT: After the split into #132 and #133 to test this for now one needs to manually setup the pythoncapi-compat bit.

HaoZeke avatar Jun 01 '25 11:06 HaoZeke

Unlike #130, tests pass here https://github.com/bodono/scs-python/actions/runs/15374887139/job/43258511781?pr=1312

HaoZeke avatar Jun 01 '25 12:06 HaoZeke

Thanks for taking this on! Let me know when you think it is ready to merge!

bodono avatar Jun 13 '25 13:06 bodono