Hacker News new | ask | show | jobs
by pansa2 1847 days ago
> How do you prevent interleaving of different threads then?

The GIL.

> Why? Python 3 broke a whole lot of applications and libraries.

Sorry, I mean it must remain that way if it is to maintain compatibility. We’re assuming that breaking compatibility is unacceptable.

2 comments

Most Python 3 breakage was search-replace fixable (though I'd question the value of language changes falling in this category), although it is true that the text/bytes separation exposed unsound data models in some applications, which is of course nasty to deal with.
Why did it take projects and Google so long to migrate?
> The GIL.

How does the the GIL prevent interleaving? My understanding is that if an "operation" takes several steps, eg. reading from a dict then IO or a C extension and finally writing to a dict the GIL will not make this atomic.