summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2020-01-13 18:33:05 -0800
committerQuentin Pradet <quentin@pradet.me>2020-01-14 09:48:22 +0400
commit9971e27e83a891ba7b832fa9e5d2f04bbcb1e65f (patch)
tree3cd36f755f02aa9540acfd452c3c7a870737b2ea /src
parent62ef68e49edf5dabde26732a154d0e925cef7301 (diff)
downloadurllib3-9971e27e83a891ba7b832fa9e5d2f04bbcb1e65f.tar.gz
Empty responses should have no lines.
Previously, iterating the lines of an empty response would yield the empty string once. However, the iterator should instead never yield anything. This is consistent with file io; `open('/dev/null', 'rb').readlines()` is `[]`.
Diffstat (limited to 'src')
-rw-r--r--src/urllib3/response.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/urllib3/response.py b/src/urllib3/response.py
index adc321e7..6090a735 100644
--- a/src/urllib3/response.py
+++ b/src/urllib3/response.py
@@ -792,7 +792,7 @@ class HTTPResponse(io.IOBase):
return self._request_url
def __iter__(self):
- buffer = [b""]
+ buffer = []
for chunk in self.stream(decode_content=True):
if b"\n" in chunk:
chunk = chunk.split(b"\n")