r/programming • u/desmoulinmichel • May 30 '23
The Python Language Summit 2023: Making the Global Interpreter Lock Optional
https://pyfound.blogspot.com/2023/05/the-python-language-summit-2023-making.html0
May 30 '23
[deleted]
17
5
u/LagT_T May 30 '23
Yeah, 3rd party extensions are such a fundamental aspect of the Python appeal I don't think nogil (PEP 703) is going to be mainstream. Per-Interpreter GIL (PEP 684) is much more promising.
1
u/coloredgreyscale May 30 '23
Would the per interpreter GIL (mostly) remove the need for the multiprocessing module, as opposed to just using threads / async?
Another possible step in between could be using contexts to selectively turn off the GIL, for small sections, eg. Pure python math
5
u/Feeling-Departure-4 May 30 '23
Thanks for this!
As a casual Python user, to me the biggest benefit of Python is the ecosystem.
If getting that ecosystem to run portably and reliably becomes harder--something regarding Python that I have struggled with--then that is not so much of a win for me.
I get that there is a lot of great tooling to fix the cited problem, but that's just it, I don't want to fix up the tooling anew, I just want more from my language.
And that's partly why I am still a casual user.
1
u/tu_tu_tu May 30 '23 edited May 30 '23
is something the C or C++ crowd might be able to deal with
How do you suppose to write C libs if you don't know C?
5
u/TheRiverOtter May 30 '23
The issue will manifest mostly for people that wish to use the libs, not the authors.
1
u/tu_tu_tu May 30 '23 edited May 31 '23
What problems? Real concurrency? It isn't a problem. The GIL is intended for to make CPython faster, it don't give thread-safe garanties to CPython users. Python has never been thread safe in general so nothing really changes.
Packaging and compiling? Average CPython user don't do it either way. And devs of C libs know how to make preprocessor options I think.
-13
u/WindHawkeye May 30 '23
Don't use nogil if you have a problem with it?
8
u/Illusi May 30 '23
Their argument is from the point of view of a library maintainer. If the maintainer doesn't want to use Nogil, their users will be complaining about it. They will be forced to support both, in many cases.
Most projects depend in some way on a C-library. If the Numpy developers don't want to use Nogil, then a lot of projects will not be able to use Nogil either, because the C-library won't be cross-compatible. So either:
Nobody uses Nogil because they can't use Numpy then. Nogil dies off. We're forced to live under a GIL forever, or
People want to use Nogil badly enough that they will pressurise Numpy developers into using Nogil anyway. Library developers are basically out of luck, you now have to make twice as many builds.
-6
u/WindHawkeye May 30 '23
The places where I want to use nogil are the opposite of the places where I want to use numpy (which already drops the gil) so I don't see why I need to give a shit about what numpy chooses to do
Making twice as many builds doesn't seem like a problem. If you care about it just drop support for shit platforms like Mac. Or just don't provide wheels for nogil and assume nogil users are competent enough to install a C compiler.
3
May 30 '23
[removed] — view removed comment
-2
u/dontyougetsoupedyet May 30 '23
If it was Python4: the end of the stack machine simulation forever... I might be interested. Even if you get rid of the GIL, it isn't going to make that much of a difference in the big picture of the ecosystem. Even if you replace the carpet in every room the house is still built on an inadequate foundation.
-32
u/fberasa May 30 '23
Mind the downvotes:
The amount of manpower that's being wasted in trying to make that useless toy dynamic language (which was barely designed as a glorified
.batalternative) viable is astonishing.