[Python-Dev] Free threading

Guido van Rossum guido@python.org
Tue, 07 Aug 2001 13:46:00 -0400

> > Let's not forget 'free threading', which is another one of those 'generally
> > benificial' features that will break code.

> Is that true? I thought that you would have to ASK to use free threading
> in a particular program.

Dunno -- in any case I'm not even sure how free threading would break
code (as long as it shouldn't be allowed to cause core dumps, basic
data structures ought to be threadsafe under free threading).

> I'm discussing threading models with our internal Perl guys and I'm
> curious about one thing: what prevents a person from running two
> non-communicating Python interpreters in two threads? What kind of data
> is shared between interpeters?

Nothing stops you from doing that -- the intention is that it's
possible.  Immutable objects (like strings and ints) and all built-in
type objects (including extension types) are shared between all
interpreters.  Interned strings are shared.  Exceptions are shared
(there may actually be a bug related to initializing exceptions that I
still have to track down).  Extension modules that have global state
may cause additional confusion.  Operating system resources like file
descriptors are shared.

--Guido van Rossum (home page: http://www.python.org/~guido/)