[Python-3000] sys.exc_info()
Mark Hammond
mhammond at skippinet.com.au
Sun Jun 1 03:08:15 CEST 2008
Antoine:
> Mark Hammond <mhammond <at> skippinet.com.au> writes:
> > In both Python 2.x and 3 (a few months old build of Py3k though), the
> > traceback isn't the same. For Python 2.0 you could write it like:
> >
> > def handle_exception():
> > ...
> > raise sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]
> >
> > Its not clear how that would be spelt in py3k though (and from what I
> can
> > see, sys.exc_info() itself has an uncertain future in py3k).
>
> sys.exc_info() will remain, it's just that the returned value will be
> (None, None, None) if we are not in an except block in any of the
> currently active frames in the thread.
If I look at Guido's py3k status update of almost a year ago
(http://www.artima.com/weblogs/viewpost.jsp?thread=208549) it tells me:
* "sys.exc_info() becomes redundant (or may disappear)". Even if it doesn't
actually dissappear, the implication is that the new way (with the traceback
being an attribute) will be preferred.
* "The old raise syntax variants raise E, e and raise E, e, tb are gone" -
but I can't see anything which indicates what the replacement is for the 2
cases of (a) raising with the original traceback and (b) raising the same
exception with a "new" traceback reflecting the position of the 'raise'-
I admit I didn't look *that* hard though...
Mark
More information about the Python-3000
mailing list