[Stackless] Exception passing patch
richard.m.tew at gmail.com
Wed Dec 2 22:49:46 CET 2009
2009/12/3 Peter Ingebretson <pingebre at yahoo.com>:
> This is all possible using stock stackless without my patch. Unfortunately, if the ownership depth exceeds one level it can be very difficult to debug where an exception originated. Being able to associate traceback information with a passed exception addresses this problem.
While it is not the same, you can still send exceptions through
channels with the existing functionality. Or if you need an exception
to be raised, raise a custom exception passing the caught local
The ability to pass exception instances caught in one context, to be
raised eventually in another.. it does not seem like a good
programming practice. To me, the existing mechanism, even used to
carry the exception as a payload, seems like the correct way to do
> I considered extending tasklet.raise_exception and channel.send_exception to take an optional traceback keyword argument, but after reading http://www.python.org/dev/peps/pep-3109/ it seemed that supporting passing exception instances was more in line with the direction that Python 3.x was heading.
Ah well, if raising exceptions out of generators is valid, then I can
hardly object to the same being possible with channels. But I do not
think there is a reason to deprecate the old behaviour.
More information about the Stackless