[pypy-dev] some questions

Armin Rigo arigo at tunes.org
Thu Dec 21 17:44:00 CET 2006

Hi Aurelien,

On Tue, Dec 19, 2006 at 06:50:46PM +0100, Aur?lien Camp?as wrote:
> * is there a chance that a peer review and eventual correction/advice
> on that non-working code can yield a working solution in a reasonnable
> amount of time ?

No.  Getting the original coroutine cloning code to really work
correctly took us quite some time, and certainly more than 10 days,
including a final night following data structures at the C level with
ddd.  (Btw, that's a gdb front-end that I really recommend for Debugging
and Displaying Data :-)  It looks innocent enough but it is really
subtle code, so you should try to build on top of that and not reinvent
it from scratch.

Note also that if you need sets of several coroutines that are all
cloned together, it's possible to put each set in a single
InterpClonableCoroutine that acts as a "big" thread; and it would itself
contain several regular Coroutines for its own local purposes.  This
works nicely if in each InterpClonableCoroutine you first create a new
CoState() instance, and use it as the 'state' argument of all the local
Coroutines.  This local CoState has a current and a main that are local
too.  If you clone one of the "big" InterpClonableCoroutine, everything
will be cloned - the local CoState and its Coroutines.

Hum, actually for now that's theory only.  The local Coroutines have a
__del__ and objects with a __del__ are never cloned.  I guess that my
point is that we could make this work with minimal efforts (e.g. with a
variety of Coroutines that doesn't need a __del__).

> The later option would entail throwing away ten days of work, and
> spending a more days to reorganize and rewrite stuff, but can be done
> while retaining a reasonnable amount of functionnality.

Well, I would have given you the same answer 10 days ago, or even a few
months ago, if only I had known.  I should point out that we ("the
technical board") tried to ask Logilab in general to tell us what plans
they had, and we tried quite a few times now, so I fail to feel bad
about telling you now to throw away just 10 days of work, sorry.

A bientot,


More information about the Pypy-dev mailing list