From ae2d59f75b432ca7a0bf3e04765833bc9cf30314 Mon Sep 17 00:00:00 2001 From: "Phillip J. Eby" Date: Fri, 7 Jan 2011 15:45:26 +0000 Subject: [PATCH] Fix re-raise syntax for Python 3 --- pep-3333.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-3333.txt b/pep-3333.txt index d8ec72331..c5f21ae45 100644 --- a/pep-3333.txt +++ b/pep-3333.txt @@ -323,7 +323,7 @@ server. try: if headers_sent: # Re-raise original exception if headers sent - raise exc_info[0], exc_info[1], exc_info[2] + raise exc_info[1].with_traceback(exc_info[2]) finally: exc_info = None # avoid dangling circular ref elif headers_set: @@ -874,9 +874,9 @@ occurred. However, if ``exc_info`` is provided, and the HTTP headers have already been sent, ``start_response`` **must** raise an error, and **should** -raise the ``exc_info`` tuple. That is:: +re-raise using the ``exc_info`` tuple. That is:: - raise exc_info[0], exc_info[1], exc_info[2] + raise exc_info[1].with_traceback(exc_info[2]) This will re-raise the exception trapped by the application, and in principle should abort the application. (It is not safe for the