[Stackless] Patch to exception handler.

Gil Colgate gcolgate at gmail.com
Mon Apr 9 20:43:34 CEST 2012


Here is a fix for the exception handler, I included just the .patch.

    This corrects the problems with python having a different exception the
environment when the item is called again.

    In the previous code, whenever a python tasklet was suspended the top
of the exception chain was saved. This very well could be a pointer into
code above the python stack into the main program. When the python tasklet
is called again, it's stack is put back *in the same place*, but the
environment above the stack *might be different*. This would cause the
exception chain to screw up in the part where the exception chain points
above the stack. This was the cause of the broken exception chain bug.


    If a tasklet has none of it's own exception chains, we will discover
this by reading the exception list and seeing that the address is above the
stack, so we don't need to save or restore it it.

    If, on the other hand, the tasklet has a chain we save it. When
restoring it we look at the current chain and insert the chain from the
restored stack into it at the appropriate spot, so that the tasklet's chain
points correctly into it's parent's change.

    Stack slicing: Stackless in general has a problem with stack slicing.
This code will work in when the stack is sliced (I tested it with 2K stack
slices and try-catches everywhere) but certain exceptions that belonged to
inactive stack slices will not be executed since they are not currently
linked into the chain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120409/51346a11/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stacklesseval.c.patch
Type: application/octet-stream
Size: 6369 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20120409/51346a11/attachment.obj>


More information about the Stackless mailing list