[Python-3000] Pre-peps on raise and except changes (was: Warning for 2.6 and greater)

Phillip J. Eby pje at telecommunity.com
Sat Feb 10 04:44:22 CET 2007


At 05:03 PM 2/9/2007 -0800, Guido van Rossum wrote:
>On 2/9/07, Collin Winter <collinw at gmail.com> wrote:
> > sys.exc_info() will be kept, while the sys.exc_{type,value,traceback}
> > attributes will be dropped.
>
>I understand why, but that doesn't make me uncomfortable with keeping
>it. Maybe in "3.0 compatibility mode" 2.6 could attach tracebacks to
>exception objects so we could be weened off it in 2.6?

I notice that neither PEP addresses PEP 343 compatibility.  Do we plan to 
make __exit__() only get one argument?  Right now the protocol demands all 
three.  I suppose we could pass one argument in 3.0, and if you want to 
support 2.6 you would have to add default arguments.  Such code would be 
ugly as sin, but workable.

I'm not 100% certain we *can't* ditch sys.exc_info(), but if we do, we 
still need *some* way to get the "current exception" and have it include a 
traceback, that will also work in 2.6.  I don't believe there's any 
proposal for such an API currently outstanding.

WSGI still uses sys.exc_info tuples, but we could always add a 
wsgiref.exc_info() that gets the current exception and turns it into such a 
tuple.  ;-)

Anyway, I suggest we either decide to deal with that sort of ugliness, or 
decide to live with sys.exc_info(), and then get on with whichever of those 
two choices you decide to make.  :)



More information about the Python-3000 mailing list