Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d594849

Browse files
committed
Ignore sizehint argument. Fixes SF #844561.
1 parent 6bee23c commit d594849

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Lib/codecs.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,14 +303,11 @@ def readlines(self, sizehint=None):
303303
Line breaks are implemented using the codec's decoder
304304
method and are included in the list entries.
305305
306-
sizehint, if given, is passed as size argument to the
307-
stream's .read() method.
306+
sizehint, if given, is ignored since there is no efficient
307+
way to finding the true end-of-line.
308308
309309
"""
310-
if sizehint is None:
311-
data = self.stream.read()
312-
else:
313-
data = self.stream.read(sizehint)
310+
data = self.stream.read()
314311
return self.decode(data, self.errors)[0].splitlines(1)
315312

316313
def reset(self):
@@ -488,10 +485,7 @@ def readline(self, size=None):
488485

489486
def readlines(self, sizehint=None):
490487

491-
if sizehint is None:
492-
data = self.reader.read()
493-
else:
494-
data = self.reader.read(sizehint)
488+
data = self.reader.read()
495489
data, bytesencoded = self.encode(data, self.errors)
496490
return data.splitlines(1)
497491

0 commit comments

Comments
 (0)