News for hackers. Stuff that matters.
Re:No-GIL mode coming for Python by xmonkee on Friday July 28, 2023 @10:51PM (#36916346)
no-GIL libs will work with the GIL on surely? So you won’t have to support both?
Re:No-GIL mode coming for Python by qbasic_forever on Friday July 28, 2023 @11:07PM (#36916453)
Where will you get no-GIL libraries, especially in the early days? Just yell at the maintainers of core libs like flask and requests until they use their volunteer and spare time to implement incredibly complex and tricky locking semantics all over their codebases, AND test it all with both GIL and non-GIL interpretors at scale to suss out race conditions? That just happens for free and overnight because a lot of people are plus one mashing on GitHub issues I guess?
Re:No-GIL mode coming for Python by kzrdude on Saturday July 29, 2023 @03:18AM (#36917744)
Flask is pure python, isn't it?
Re:No-GIL mode coming for Python by qbasic_forever on Saturday July 29, 2023 @04:51AM (#36918272)
Even pure python code could have race conditions with the GIL disabled. Stuff like accessing and modifying a dictionary item in python code is assumed and currently guaranteed to be atomic because of the GIL. Remove the GIL and decades of assumptions break.
Re:No-GIL mode coming for Python by kzrdude on Saturday July 29, 2023 @05:45AM (#36918531)
I think that's a misconception? At least the way how I understood this issue.

Things like `map[k] = v` would be atomic both before and after nogil, and things like `map[k] += 1` are not atomic even with GIL, the read and store can be split from each other.

Re:No-GIL mode coming for Python by samus on Saturday July 29, 2023 @06:44AM (#36918864)
The GIL doesn't serialize the execution of threads, but ensures only one executes at a time. Therefore, the race condition issues you describe already exist even with the GIL. The GIL is only there to ensure that the interpreter doesn't corrupt Python objects and its internal data structures, which in the best case leads to a crash.
Re:No-GIL mode coming for Python by imtringued on Saturday July 29, 2023 @04:12PM (#36924064)
Come on, think about it harder. Do you really think this would even have a chance of becoming a PEP if python code was affected? If you thought even a little bit about it, then you would have come to the very simple conclusion "no" but here we are.
Re:No-GIL mode coming for Python by paulddraper on Saturday July 29, 2023 @06:18PM (#36925303)
In Python, race conditions with the GIL will be race conditions without the GIL, and vice versa.

....I believe so.

E.g. there's no plan to make lists, dicts, thread unsafe.

Re:No-GIL mode coming for Python by kzrdude on Sunday July 30, 2023 @09:53AM (#36931164)
But it's going to be much easier to demonstrate data consistency issues and bugs due to threading
Re:No-GIL mode coming for Python by martijnvds on Saturday July 29, 2023 @03:28AM (#36917797)
If I understand correctly how the GIL works, the change will only affect libraries with native componentsml. Everything that's pure python will continue to work unchanged.
Re:No-GIL mode coming for Python by imtringued on Saturday July 29, 2023 @04:09PM (#36924047)
What exactly am I reading here? Requests and flask are both 100% python libraries. Do you take pleasure in trolling people?