From 5c0deb5bdbab4cbe39ebb169377e59b44880db77 Mon Sep 17 00:00:00 2001 From: Unbit Date: Mon, 20 May 2013 23:31:14 +0200 Subject: [PATCH] correctly handle pep333 exc_info in pypy --- plugins/pypy/pypy_setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/pypy/pypy_setup.py b/plugins/pypy/pypy_setup.py index 03fc6d7f..ebc57eed 100644 --- a/plugins/pypy/pypy_setup.py +++ b/plugins/pypy/pypy_setup.py @@ -3,6 +3,7 @@ import os sys.path.insert(0, '.') sys.path.extend(os.environ.get('PYTHONPATH','').split(os.pathsep)) import imp +import traceback mainmodule = type(sys)('__main__') sys.modules['__main__'] = mainmodule @@ -174,6 +175,8 @@ def uwsgi_pypy_wsgi_handler(wsgi_req, core): lib.uwsgi_response_write_body_do(wsgi_req, ffi.new("char[]", data), len(data)) def start_response(status, headers, exc_info=None): + if exc_info: + traceback.print_exception(*exc_info) lib.uwsgi_response_prepare_headers(wsgi_req, ffi.new("char[]", status), len(status)) for hh in headers: lib.uwsgi_response_add_header(wsgi_req, ffi.new("char[]", hh[0]), len(hh[0]), ffi.new("char[]", hh[1]), len(hh[1]))