[Stackless] Exception passing patch

Peter Ingebretson pingebre at yahoo.com
Wed Dec 2 04:57:06 CET 2009

The two primary methods for passing exceptions between tasklets (channel.send_exception and tasklet.raise_exception) currently only allow sending an exception type and optional exception arguments.  An exception instance cannot be sent, which means any instance-specific data such as an exception __traceback__ must be either sent as arguments or else is lost.  Although a bomb can be used to preserve the traceback, it is not ideal for general use.

The attached patch proposes extending the semantics of these methods to also allow sending exception instance.  For backwards compatibility, passing a type and arguments is still allowed, although for consistency with Python 3.x this should potentially be deprecated.

I've also added a unit test to verify that exception instances can be sent over channels and that the traceback for such exceptions is preserved.

Does this seem like a reasonable patch?  Do you have any suggestions for how this should be done differently; for instance, should sending a exception type be deprecated now?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: exception_passing.diff
Type: application/octet-stream
Size: 6898 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20091201/e7895f98/attachment.obj>

More information about the Stackless mailing list