[Stackless] Stackless for Python 2.5b2 / help required

Richard Tew richard.m.tew at gmail.com
Fri Aug 4 15:31:04 CEST 2006


On 8/3/06, Jeff Senn <senn at maya.com> wrote:
> doing the unwinding (especially around gen_send_ex).
> Basically what is happening is that the 2nd to last function call return is
> resumed with PyEval_EvalFrame_noval in
> f->f_execute (rather than the EvalFrame_value version as I would expect) and
> therefore the return value is not pushed onto the stack.

Here is a patch which fixes the problem.   However, there are
a few more things that need to be done before I am satisfied it
is the correct fix.  For one thing, if it is reached and f_execute
is _iter, then I have not considered what should happen then.
The modified reproduction case also crashes in 2.5 and is
runnable in 2.4.3, but does not crash there.  Looking at what
it does differently when it gets to that point should hopefully
highlight the proper behaviour.

Then there is another bug which can be reproduced by running
Stackless\test\taskspeed.py which needs to be fixed as well.

Anyway, its a step forward :)
Richard.


Modified reproduction case:

def gen():
    yield None

def foo(a):
    try:
        a.next()
    except:
        pass

def test(a):
    a.next()
    try:
        yield None
    except:
        foo(a) # note that unrolling this func call "fixes" the problem

test(gen()).next()

Index: ceval.c
===================================================================
--- ceval.c	(revision 51087)
+++ ceval.c	(working copy)
@@ -2847,8 +2847,10 @@
 		return retval;
 	STACKLESS_UNPACK(retval);
 	retval = tstate->frame->f_execute(tstate->frame, 0, retval);
-	if (tstate->frame != f)
+	if (tstate->frame != f) {
+		f->f_execute = PyEval_EvalFrame_value;
 		return retval;
+	}
 	if (STACKLESS_UNWINDING(retval))
 		STACKLESS_UNPACK(retval);

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list