Skip to content

Commit b63b1b9

Browse files
authored
Update read-n-characters-given-read4.py
1 parent 6f43aeb commit b63b1b9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/read-n-characters-given-read4.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def read(self, buf, n):
4040
for i in xrange(n / 4 + 1):
4141
size = read4(buffer)
4242
if size:
43-
to_read = min(n-read_bytes, size)
44-
buf[read_bytes:read_bytes+to_read] = buffer[:to_read]
45-
read_bytes += to_read
43+
size = min(size, n-read_bytes)
44+
buf[read_bytes:read_bytes+size] = buffer[:size]
45+
read_bytes += size
4646
else:
4747
break
4848
return read_bytes

0 commit comments

Comments
 (0)