[Python-3000] Exceptions internals and removing sys.exc_*

Brett Cannon brett at python.org
Mon Jan 22 19:14:33 CET 2007


On 1/22/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> On 1/22/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> > At 06:43 PM 1/21/2007 -0800, Brett Cannon wrote:
> > >But when something as obvious as moving
> > >the traceback to exceptions ... should take the chance to ditch the old way
>
> > How will this affect the __exit__ signature for context managers, which is
> > defined in sys.exc_info() terms?  Also, WSGI defines certain
> > exception-handling parameters in terms of sys.exc_info().
>
> They can refer to python 2.x, which will still have it.
> They can be explicit, and mention a 3-tuple of exception (type, value,
> traceback).
>
> They should grow an alternate interface that just takes an exception instance.
>

The other way would be to add a method to exceptions that return the
three objects.

> > Will we also be dropping three-argument "raise"?
>
> Is there any reason not to drop it?
>
> Even in py2.x, the only reasons I see not to use the single-argument form
>
>     >>> raise Exception("args")
>
> are that (1)  you want to support string exceptions, or (2)  you want
> to change the traceback, which could now be done with the traceback
> (context/cause) attributes.
>

Especially since as of right now the syntactic support for
three-argument 'raise' statements is slated to go away and
BaseException currently does not accept a traceback argument.

-Brett


More information about the Python-3000 mailing list