[Stackless] Stackless for Python 2.5b2 / help required

Jeff Senn senn at maya.com
Fri Aug 4 20:42:43 CEST 2006


Richard Tew wrote:

> I am pretty confident that the bug is just the ability to return within
> stackless_call without ensuring that f_execute is not _noval.  And
> I also believe it should be present in 2.4.3 as well.  It is just quite
> hard to trigger.

Hm. To put this another way: If you change the f_execute to _noval you'd
better change it back again when you're "done".  However it might
be hard to know exactly when we're done...

I see what you fix does - and I think I agree that it should solve the
current problem - though I'm worried that wackier cases might exist...

Oh! I'm wondering why this code doesn't already work:

#ifdef STACKLESS
	if (f->f_execute == PyEval_EvalFrame_value) {
         /* this is a return */
		PUSH(retval); /* we are back from a function call */
	}
	else {
		if (f->f_execute == PyEval_EvalFrame_iter) {
...
		else {
			/* don't push it, frame ignores value */
			Py_XDECREF(retval);
		}
		f->f_execute = PyEval_EvalFrame_value;
^^^^^^^^^^^^^^^^should get fixed right here^^^^^^^^^^^^^^^^^^^^^^^^^^^

Aha! Just above that there is a case ("if(throwflag)") that does a goto
*BEFORE* this can switch back from _noval to _value.

D'oh!

So I think this patch (an alternative to yours) also fixes the problem,
but in a way that is *much* easier to understand and more consistent with the
original intent:


         if (throwflag) { /* support for generator.throw() */
                 why = WHY_EXCEPTION;
+#ifdef STACKLESS
+               if(f->f_execute == PyEval_EvalFrame_noval) {
+                 f->f_execute = PyEval_EvalFrame_value;
+               }
+#endif
                 goto on_error;
         }






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



More information about the Stackless mailing list