Re:A Python Interpreter Written in Rust
by loeg on Saturday February 02, 2019 @06:06PM
(#19066419)
It's basically impossible to implement a CPython-compatible language without a GIL (or you lose single thread performance by using very fine-grained atomics/locking). Python has very specific multithreading semantics that are a function of the CPython bytecode and the GIL, and programs rely on this.
[ Parent
| on HN ]
Re:A Python Interpreter Written in Rust
by int_19h on Saturday February 02, 2019 @08:25PM
(#19067147)
Other than refcounting (which is not a part of the Python language spec - it even specifically says that conforming code shouldn't rely on it), what other semantics did you have in mind?
Re:A Python Interpreter Written in Rust
by sametmax on Saturday February 02, 2019 @08:37PM
(#19067205)
You can list.append from 2 threads without worrying about crashing, although I would not recommend it.
It's possible to do without the GIL, but up to now, it's been a damn to way of doing that.
I don't think that's guaranteed, though.
loeg says, "programs rely on this".
Guarantee or not, it constrains whether something is usable as a drop-in replacement interpreter, especially if people can't tell which programs will break, and doubly so if the breakage is a subtle data corruption race that doesn't show up in tests.