3 ms·
For so long as the GIL persists, you are correct, and thus Python does not have data races and is able to achieve memory safety in this regard. It is conceivab
by tialaramex 4y ago
For so long as the GIL persists, you are correct, and thus Python does not have data races and is able to achieve memory safety in this regard.
It is conceivable (but extremely unlikely, 'cos it was really, really hard) that after a GILectomy Python follows the Java path, in which data races are technically safe†. However it is most likely Python with a GILectomy will behave like Go or C# or numerous other languages and lose memory safety properties if a data race occurs.
† Data races can happen in Java, and astonishing things might happen, but objects always remain in some valid state, so there is no loss of memory safety whereas in most languages with data races you can e.g. race a hash table and mess up its internals and cause chaos.