handle size 0 read by returning empty buffer

It appears the original author meant to return b"" when size == 0 instead of raise ValueError("Size must be positive.")
This commit is contained in:
David Vincelli 2012-12-20 11:48:44 -05:00 committed by benoitc
parent 174c34ec9c
commit c2ae9090dc

View File

@ -18,7 +18,7 @@ class ChunkedReader(object):
def read(self, size):
if not isinstance(size, six.integer_types):
raise TypeError("size must be an integral type")
if size <= 0:
if size < 0:
raise ValueError("Size must be positive.")
if size == 0:
return b""