3 ms·
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 volun
by qbasic_forever 3y ago
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?
- kzrdude 3y agoFlask is pure python, isn't it?
- qbasic_forever 3y agoEven 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.
- kzrdude 3y agoI 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.
- samus 3y agoThe 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.
- imtringued 3y agoCome 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.
- paulddraper 3y agoIn 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.
- kzrdude 3y agoBut it's going to be much easier to demonstrate data consistency issues and bugs due to threading
- martijnvds 3y agoIf 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.
- imtringued 3y agoWhat exactly am I reading here? Requests and flask are both 100% python libraries. Do you take pleasure in trolling people?