Skip to content

add free-threading support - #693

Merged
fantix merged 4 commits into
MagicStack:masterfrom
kumaraditya303:master
Oct 15, 2025
Merged

fantix merged 4 commits into
MagicStack:masterfrom
kumaraditya303:master

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Oct 11, 2025 •

Copy link
Copy Markdown
Contributor

This adds free-threading support by adding freethreading_compatible=True in loop.pyx and also enables CI and wheels for 3.14t.

cc @fantix

Comment thread tests/test_tcp.py Resolved
@Vizonex

Vizonex commented Oct 11, 2025

Copy link
Copy Markdown

Don’t mind by me asking but do you have the time to look into winloop as well? Or will I have to mirror everything and guess with blind faith?

@achimnol

Copy link
Copy Markdown
Contributor

👀 Also looking forward to MagicStack/asyncpg having free-threading support...

@Vizonex

Vizonex commented Oct 12, 2025

Copy link
Copy Markdown

👀 Also looking forward to MagicStack/asyncpg having free-threading support...

Same

@kumaraditya303

Copy link
Copy Markdown
Contributor Author

Don’t mind by me asking but do you have the time to look into winloop as well? Or will I have to mirror everything and guess with blind faith?

There isn't anything to guess with blind faith here, you can follow the guide at https://py-free-threading.github.io/ci/ to add free-threading CI to projects you wish. I have never looked at winloop before so I'll not have time for that atm.

@1st1

1st1 commented Oct 14, 2025

Copy link
Copy Markdown
Member

Would be nice to add a test (should be possible with uv) that it does actually work cc @fantix

@kumaraditya303

Copy link
Copy Markdown
Contributor Author

Would be nice to add a test (should be possible with uv) that it does actually work cc

The existing tests pass on free-threading 3.14t CI which I added as part of this PR (the failing one test is a flaky test), do you want a test where uvloops are run in parallel threads?

@fantix

fantix commented Oct 14, 2025

Copy link
Copy Markdown
Member

I added a race-condition test, which is confirmed to fail without freethreading_compatible=True. @1st1

Many thanks to @kumaraditya303 for putting this altogether!

@Vizonex

Vizonex commented Oct 15, 2025

Copy link
Copy Markdown

@kumaraditya303 I'm going to start mirroring these changes going on. No promises of when I'll finish unless It gets done in a rational amount of time. If needed I will open a uv virtual environment with the free-threading settings and version 3.14 set and testing locally.

@Vizonex

Vizonex commented Oct 15, 2025 •

Copy link
Copy Markdown

Good News: I have successfully mirrored the changes from here, winloop 0.3.0 will release soon since I now obey how version numbers actually work and since the __init__.py script for winloop significantly changed. Thanks for your help again.

Bad News: uvloop also seems there's some rounding bugs with macos from the tests that I've seen I am also question why my library has the same problem. But maybe if we find a way to fix it I'll try doing the same with winloop's end. Rounding has always been a bit of a problem for a while (not sure why exactly).

@fantix

fantix commented Oct 15, 2025

Copy link
Copy Markdown
Member

Yeah, it's definitely getting more flaky to run tests, and there're a few warnings to take care of. Let's release for Python 3.14 first, and get back to those as follow-ups.

@Vizonex

Vizonex commented Oct 15, 2025

Copy link
Copy Markdown

Yeah, it's definitely getting more flaky to run tests, and there're a few warnings to take care of. Let's release for Python 3.14 first, and get back to those as follow-ups.

Good idea.

@fantix
fantix merged commit 286b370 into MagicStack:master Oct 15, 2025
fantix added a commit that referenced this pull request Oct 15, 2025
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 15, 2025
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 16, 2025
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 d9fa054 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
fantix added a commit that referenced this pull request Oct 16, 2025
Changes
=======

* Fixes for Python 3.14 (#638)
  (by @graingert @hroncok @paulocheque @fantix in 46456b6 for #637)

* Add free-threading support (#693)
  (by @kumaraditya303 in 286b370 for #642)

Fixes
=====

* Use Cython `enum` for `__PREALLOCED_BUFS` (#634)
  (by @jakirkham in 7bb12a1 for #634)

* test: fix getaddrinfo test (#663)
  (by @fantix in 5680792 d9fa054 for #663)

* test: fix task name for Python 3.13.3/3.14 (#662)
  (by @cjwatson in 96b7ed3 for #662)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants