[Web-SIG] Declaring PEP 3333 accepted (CGI example)

Antoine Pitrou solipsis at pitrou.net
Fri Jan 7 17:38:09 CET 2011


Hello,

P.J. Eby <pje at ...> writes:
> 
> >                  if headers_sent:
> >                      # Re-raise original exception if headers sent
> >-                    raise exc_info[0], exc_info[1], exc_info[2]
> >+                    raise 
> >exc_info[0](exc_info[1]).with_traceback(exc_info[2])
> >              finally:
> >                  exc_info = None     # avoid dangling circular ref
> 
> Can somebody weigh in on what the correct translation here is?  The 
> only real Python 3 coding I've done to date has been experiments to 
> test changes to other aspects of WSGI.  

You don't need the "with_traceback". Just "raise exc_info[1]". The original
traceback is already attached to the exception instance (major difference from
Python 2).

Oh and by the way:

    headers_set = []
    headers_sent = []

This is really a recipe for disaster. Please give these two variables clearly
distinct names. Your example is very confusing to read because of this.

Regards

Antoine.




More information about the Web-SIG mailing list