Re: Declaring PEP 3333 accepted (CGI example)

Antoine Pitrou <[email protected]>
Newsgroups gmane.comp.python.web
Message-ID <[email protected]>
Hello,

P.J. Eby <pje@...> 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.


_______________________________________________
Web-SIG mailing list
[email protected]
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: http://mail.python.org/mailman/options/web-sig/gcpw-web-sig%40m.gmane.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.