Martin Panter added the comment:

Okay now I see the conflict. The use of WSGIRequestHandler with wbufsize = 0 
was the missing key. I see two possible solutions:

1. Change SimpleHandler._write() to allow self.stdout to be a RawIOBase writer, 
and loop over stdout.write() until all the data is written. This seems to be 
what most people are suggesting here. But it requires that stdout.write() 
returns the number of bytes written, so could be a compatibility problem.

2. Document that the SimpleHandler(stdout=...) parameter should be a 
BufferedIOBase writer, and fix WSGIRequestHandler to pass in a BufferedWriter 
(by overriding the wbufsize attribute with -1 or io.DEFAULT_BUFFER_SIZE).

I am not super familiar with the wsgiref package, but the second option seems 
more preferable to me and more in line with my understanding of how it was 
intended to work.

----------
stage: test needed -> needs patch
versions: +Python 3.6 -Python 3.4

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to