[Stackless] Patch to exception handler.

Richard Tew richard.m.tew at gmail.com
Mon Apr 16 23:52:56 CEST 2012


This is something for kristjan to look into when he gets the time :)

On Tuesday, April 17, 2012, Gil Colgate wrote:

> Did this meet with anyone's approval?
>
> On Mon, Apr 9, 2012 at 11:43 AM, Gil Colgate <gcolgate at gmail.com<javascript:_e({}, 'cvml', 'gcolgate at gmail.com');>
> > wrote:
>
>> 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/20120417/8d8be5d5/attachment.html>


More information about the Stackless mailing list