[uWSGI] Error responses in Python 3.5

Glenn Jones glenn at pythonanywhere.com
Thu Mar 17 12:00:17 CET 2016


It appears that sending a WSGI error response is broken with the Python 
3.5 plugin. Here is a little WSGI app that repros the problem:

import sys
def application(environ, start_response):
     try:
         start_response('201 OK', [('Content-Type', 'text/plain')])
         raise Exception("Borked")
         yield b"hello\n"
     except:
         start_response('500 Internal Server Error', [('Content-type', 
'text/plain')], sys.exc_info())
         yield b"an error errored"

With the Python 3.4 plugin, the error content is delivered correctly. In 
Python 3.5, no content is delivered and the log contains this error:

Traceback (most recent call last):
   File "/root/mini_wsgi.py", line 6, in application
     raise Exception("Borked")
Exception: Borked
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
   File "/root/mini_wsgi.py", line 9, in application
     start_response('500 Internal Server Error', [('Content-type', 
'text/plain')], sys.exc_info())
SystemError: <built-in function uwsgi_spit> returned a result with an 
error set

I believe it may be related to this Python issue: 
https://bugs.python.org/issue23571

Is there anything we can do to work around this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.unbit.it/pipermail/uwsgi/attachments/20160317/58d1d45f/attachment.html>


More information about the uWSGI mailing list