[Stackless] Exception passing patch
Peter Ingebretson
pingebre at yahoo.com
Wed Dec 2 23:40:27 CET 2009
> 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"
My patch doesn't currently support that syntax, although it was one of the things I considered. I had two arguments against supporting an optional third traceback argument:
1) It changes the semantics of send_exception, so it would have the potential to break any codebases depending on the current implementation. For example, send_exception(MyException, "My Message", my_traceback) would formerly have constructed MyException("My Message", my_traceback) but with this proposal would instead behave as:
e = MyException("My Message")
e.__traceback__ = my_traceback
This example is contrived, but I didn't want to potentially break existing code without a strong reason.
2) Python 3k has dropped support for the 'raise E, V, T' syntax in favor of 'raise E(V)' or 'e = E(V); e.__traceback__ = T; raise e'. My patch is intended for the py3k branch of Stackless, and I didn't want to add a feature which added semantics that had been removed from 'raise' itself.
Thanks,
Peter
More information about the Stackless
mailing list