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?

Thanks,
Peter


      

Attachment: exception_passing.diff
Description: Binary data

_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to