News for hackers. Stuff that matters.
Re:The Changing "Guarantees" Given by Python's Global Interp... by colesbury on Friday November 17, 2023 @10:04AM (#38304522)
You will always get either [1,2,3,4,5,6] or [4,5,6,1,2,3] in the upcoming `--disable-gil` builds of CPython 3.13 and the nogil forks. Most operations on mutable collections hold a per-object lock.

Part of the integration work will be to better document the thread-safety guarantees, but there is still a lot of work to do before we get there.

Re:The Changing "Guarantees" Given by Python's Global Interp... by HDThoreaun on Friday November 17, 2023 @10:25AM (#38304844)
Every mutable collection needs to lock before write? Sounds slow af
Re:The Changing "Guarantees" Given by Python's Global Interp... by quietbritishjim on Friday November 17, 2023 @11:08AM (#38305462)
Locks are generally very cheap if they're not contended. Of course it's all relative though!
Re:The Changing "Guarantees" Given by Python's Global Interp... by gnulinux on Friday November 17, 2023 @02:13PM (#38308506)
They're cheap but they're not free. If you do it at literally every single rw operation at runtime, it's going to add up.
Re:The Changing "Guarantees" Given by Python's Global Interp... by fbdab103 on Friday November 17, 2023 @11:17AM (#38305596)
Last I looked, the nogil implementation was some 5-10% slower than the current, owing to all of the extra locking.