r/Python • u/germandiago • Jul 09 '25
News Free-threaded (multicore, parallel) Python will be fully supported starting Python 3.14!
Python had experimental support for multithreaded interpreter.
Starting in Python 3.14, it will be fully supported as non-experimental: https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-pep779
671
Upvotes
50
u/dardothemaster Jul 09 '25
I’m asking here hoping this is relevant: will operations such as append/pop (on a list for example) still be thread safe without GIL? Where by thread safe I mean that the list won’t get corrupted
Btw really excited about free-threading and JIT
6
u/WJMazepas Jul 09 '25
But we would need to build Python itself with a flag set to get the free-threaded version if i got that right?
10
u/Plus-Ad8736 Pythoneer Jul 09 '25 edited Jul 09 '25
Could anyone help me understand why we really need free-threaded python. I know that GIL prevents true parallelism in multi threading, but doesn't we have multi processing to deal with this, which does utilize multiple cores. So with this new free threading, we would have 2 distinct mechanisms?
124
u/twenty-fourth-time-b Jul 09 '25 edited Jul 09 '25
It works.
a.py:
Edit* unsurprisingly, mileage varies. Trying to append to a shared list object gives worse timings (the number is the index of the first element added by the second thread):
58
u/Coretaxxe Jul 09 '25
This is very nice! Thrilled to see the impact on speed & lib ecosystem
25
u/bobbster574 Jul 09 '25
Missed opportunity to call it π-thon
1
u/aviation_expert Jul 10 '25
So this means that flask framework is now outdated. Even django. Because python 3.14 is multi-core? Am a beginner. What's the repercussions on web technologies when python is used, I mean does it becomes like node js? Thank you for answering!
1
u/__Deric__ github.com/Deric-W Jul 11 '25
While I welcome the new abilities that the change brings to the language I can't stop myself from feeling that this approach will be the source of many bugs and footguns in the future.
I think there should be at least better documentation about the new behavior and what to look out for (I am still worried about the interaction with pythons object dictionaries) and some more primitives in the threading module (atomic operations for example).
3
u/AalbatrossGuy Pythoneer Jul 09 '25
This is really nice! Hope the difference in speed is noticeable in the brighter side 😅
3
u/neuronexmachina Jul 12 '25
For anyone else (like me) who was wondering, there's a couple of lists (one manual, one automated) of packages with extensions that have been verified as compatible with free-threading:
* https://hugovk.github.io/free-threaded-wheels/
2
u/[deleted] Jul 09 '25
I think it needs building from source rn. Any info when its gonna become default?
1
u/uqurluuqur Jul 09 '25
Does this mean multiprocessing is obsolete?
1
u/The8flux Jul 11 '25
I am going to say this again... I can't wait. Pun intended. Lol
1
u/sambes06 Jul 12 '25
I wonder if these just means more race condition failures.
1
u/alcalde Jul 12 '25
Now I've got to move up my bucket list item of attending PyCon some day and selling "I support the GIL" t-shirts.
0
u/nguyenvulong Jul 11 '25
You mean Python π?
-2
u/EvenAcanthisitta364 Jul 12 '25
Much too complicated, this is why people with real jobs don’t code in python
15
u/[deleted] Jul 09 '25
[removed] — view removed comment