[pypy-dev] Re: [Python-Dev] Making python C-API thread safe (try 2)

Armin Rigo arigo at tunes.org
Fri Sep 12 16:28:34 CEST 2003


Hello Harri,

Sorry for the private e-mail about the Python threading issue you raied in
pypy-dev; I guess you got quite some of these. I'm sending a copy of this mail
to the pypy-dev mailing list -- Christian, this is one more application not to
forget to list in the goals :-)

I wanted to point you to the PyPy project, whose goal is to create a more
flexible Python interpreter, by writing it completely in Python instead of C.

The kind of trivial-but-tedious global transformation that you suggest to make
multiple independent interpreters in the same process is exactly the kind of
change that we aim for, thanks to extra flexibility. We are writing the
interpreter in such a way that it can be automatically translated into
efficient C code. This translator can be tailored to different usages, for
example to add an extra "PyInterpreterState*" argument to each C function it
produces.

So if you are genuinely considering patching the whole CPython source code,
consider that it is not only tedious but is a nightmare to maintain if you
want to keep up-to-date with CPython's evolution. There are several people in
the PyPy project that have tried to do exactly that for other kind of changes
(Psyco/Stackless). It is one of the motivations behind PyPy. And besides the
new flexibility, it is much more fun to write a Python interpreter in Python
than in C :-)

http://codespeak.net/pypy/


Armin



More information about the Pypy-dev mailing list