branch | stable |
changeset 40545 | 6107d4549fcc |
parent 37828 | 3e3acf5d6a07 |
child 43076 | 2372284d9457 |
--- a/mercurial/hgweb/request.py Thu Nov 08 20:04:07 2018 -0500 +++ b/mercurial/hgweb/request.py Fri Nov 09 23:49:39 2018 +0000 @@ -540,6 +540,12 @@ yield self._bodybytes elif self._bodygen: for chunk in self._bodygen: + # PEP-3333 says that output must be bytes. And some WSGI + # implementations enforce this. We cast bytes-like types here + # for convenience. + if isinstance(chunk, bytearray): + chunk = bytes(chunk) + yield chunk elif self._bodywillwrite: self._bodywritefn = write