3 ms·
it has been in Python due to the GIL.
by Groxx 1y ago
it has been in Python due to the GIL.
- i80and 1y agoIt's not atomic even with the GIL, though: another thread can run in between the bytecode's load and increment, right? The GIL's guarantees didn't extend to this.
- deleted 1y ago[deleted]
- Groxx 1y agoThere is NB_INPLACE_ADD... but I'm struggling to find enough details to be truly confident :\ possibly its existence is misleading other people (thus me) to think += is a single operation in bytecode. Or, on further reading, maybe it applies to anything that implements `_iadd_` in C. Which does not appear to include native longs: https://github.com/python/cpython/blob/main/Objects/longobject.c#L6621 https://github.com/python/cpython/blob/main/Objects/longobje...