[Stackless] Exception passing patch

Peter Ingebretson pingebre at yahoo.com
Thu Dec 3 03:02:07 CET 2009

> There must be some boilerplate involved though?  Given
> that you more than likely set up a channel and launch
> the tasklet, does a little more to take a passed exception
> and raise it, make that much more of a difference?

I could use a pattern like this:
except Exception as e:

and then after receipt of a value from c do:

if isinstance(value, WrapperException):
    raise value.e

I could also subclass channel to change the default behavior of send_exception and receive to behave in this manner, but this at least partially defeats the point of having a builtin channel.send_exception.  Extending the semantics of send_exception to allow passing an exception instance seems preferable to either of these other approaches.



More information about the Stackless mailing list