diff -r 5b530d767e67 -r 6107d4549fcc mercurial/hgweb/request.py --- 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