Message262835
| Author |
jmadden |
| Recipients |
Jonathan Kamens, Paolo Veglia, jmadden, marcjofre, martin.panter, pje |
| Date |
2016年04月03日.23:01:08 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1459724468.55.0.996654685775.issue24291@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
`self.stdin` and `self.stderr` are documented to be `wsgi.input` and `wsgi.errors`, which are both described as "file-like" objects, meaning that the `write` method should return bytes written. It seems like the same could reasonably be said to be true for `self.stdout`, though it isn't strictly documented as such.
The WSGI spec says that each chunk the application yields should be written immediately, with no buffering (https://www.python.org/dev/peps/pep-3333/#buffering-and-streaming), so I don't think having the default output stream be buffered would be in compliance.
If there is a compatibility problem, writing the loop this way could bypass it (untested):
def _write(self, data):
written = self.stdout.write(data)
while written is not None and written < len(data):
written += self.stdout.write(data[written:]) |
|