[Stackless] Stackless for Python 2.5b2 / help required

Jeff Senn senn at maya.com
Sat Aug 5 00:53:24 CEST 2006

Richard Tew wrote:
> On 8/4/06, Jeff Senn <senn at maya.com> wrote:
>> 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;
>>          }
> If stackless_call exits the current frame knowing that
> it needs the return value of the function to be put on the stack
> but leaving _noval in place, then I think that  it is doing
> something wrong intentionally.

I don't think so.  Of course 2.4.3 didn't have this because there
was no generator throw so it's hard to compare...

I'm guessing the original intent
is to clear the "_noval" during the first call into
PyEval_EvalFrame_value with it in place.  And I think
this hold for the throwflag case. The passed in retval
should be swallowed, but any future function call is a
normal function call - unless something else does a
_noval again).

> I don't know that the general problem of frames
> getting executed with incorrect f_execute values can
> be correctly identified at the start of the function.

Agreed. This patch fixes the problem before we get to that state;
i.e. the f_execute = _noval acts as a one-shot and is immediately

> Have you run the Python regression tests and Stackless
> unit tests with your fix in place?

Yep - seems to pass all the normal python tests (and it
additionally causes your patch to never have to do anything
- I inserted a temporary check).  So it passes with mine and
yours, and also passes with just mine.

I haven't carefully gone through the stackless specific
tests yet...


Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list