Though I'm largely ignorant of the problem space outside the most naive and simplest case, but I think it'd be great to warn the user if the WSGI application returns a Python3 string instead an iterable of bytes.
it is a complex topic as lot of middlewares/modules work by returning empty strings (just as a trick). They works perfectly now (even if they are wrong). Maybe we could send a warning only for the first "unicode" response
Or maybe only warn if the response is a non-empy Unicode string.
it seems a good idea
I've been banging my head several hours on this. String output is silently swallowed with Python 3 if I do this:
def app(environ, start_response):
start_response('200 OK', [])
return ["foo bar"]
Whereas it correctly processes the response if I use bytes:
def app(environ, start_response):
start_response('200 OK', [])
return [b"foo bar"]
Just for a missing b sign my program becomes a nightmare to troubleshoot! Please issue a warning.
Most helpful comment
I've been banging my head several hours on this. String output is silently swallowed with Python 3 if I do this:
Whereas it correctly processes the response if I use bytes:
Just for a missing
bsign my program becomes a nightmare to troubleshoot! Please issue a warning.