summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/urllib3/response.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index f0cfbb54..c112690b 100644
--- a/src/urllib3/response.py
+++ b/src/urllib3/response.py
@@ -69,9 +69,9 @@ class GzipDecoder(object):
return getattr(self._obj, name)
def decompress(self, data):
- ret = b''
+ ret = bytearray()
if self._state == GzipDecoderState.SWALLOW_DATA or not data:
- return ret
+ return bytes(ret)
while True:
try:
ret += self._obj.decompress(data)
@@ -81,11 +81,11 @@ class GzipDecoder(object):
self._state = GzipDecoderState.SWALLOW_DATA
if previous_state == GzipDecoderState.OTHER_MEMBERS:
# Allow trailing garbage acceptable in other gzip clients
- return ret
+ return bytes(ret)
raise
data = self._obj.unused_data
if not data:
- return ret
+ return bytes(ret)
self._state = GzipDecoderState.OTHER_MEMBERS
self._obj = zlib.decompressobj(16 + zlib.MAX_WBITS)