Closed valq7711 closed 2 years ago
Yeah, that part looks strange and can probably be simplified.
while maxread > 0:
buff = read(min(maxread, bufsize))
if not buff: raise err
yield buff
maxread -= len(buff)
Yes, this looks much better ;)
Just adding a tiny tiny bit to @defnull's answer, don't even know if this helps much but i think this is more read-able
while maxread > 0:
buff = read(min(maxread, bufsize))
if not buff:
raise err
# else
yield buff
maxread -= len(buff)
also @valq7711 please close the issue, if you have gotten your answer
Hi guys! Could anyone explain the logic behind the following piece of code: https://github.com/bottlepy/bottle/blob/71bb933649ba009cd537c2e973519d6e024c02a2/bottle.py#L1333-L1339 As I see
buff[maxread:]
always returns an empty string, sincebuff
length cannot be greater thanmaxread
, no?Thanks in advance!