diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py index 5b530d767e6726374382a7bde932bcc528568b85_bWVyY3VyaWFsL2hnd2ViL3JlcXVlc3QucHk=..6107d4549fcc762ac8eebd61a839518ef22ec115_bWVyY3VyaWFsL2hnd2ViL3JlcXVlc3QucHk= 100644 --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -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