[Stackless] Exception passing patch
Kristján Valur Jónsson
kristjan at ccpgames.com
Wed Dec 2 21:32:10 CET 2009
> -----Original Message-----
> From: Peter Ingebretson [mailto:pingebre at yahoo.com]
> Sent: 2. desember 2009 20:01
> To: Kristján Valur Jónsson; Richard Tew
> Cc: stackless at stackless.com
> Subject: Re: [Stackless] Exception passing patch
> 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.
I agree with your use case.
Just today, I was writing python code to wrap and reraise exceptions, albeit not having to do with channels
class WrappedException(Exception): pass
...
except Exception:
raise WrappedException(sys.exc_info())
...
except WrappedException, e:
raise self.wrapped.args[1], None, self.wrapped.args[2]
If your patch doesn't already do so, I'd suggest that send_exception can take up to three arguments, with the same semantics as "raise"
Cheers,
K
More information about the Stackless
mailing list