mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
For effiency, set newline character outside of loop
This commit is contained in:
parent
f958e2f8ed
commit
8acf77a042
|
@ -93,12 +93,13 @@ class ContainerIO:
|
|||
:returns: An 8-bit string.
|
||||
"""
|
||||
s = b"" if "b" in self.fh.mode else ""
|
||||
newline_character = b"\n" if "b" in self.fh.mode else "\n"
|
||||
while True:
|
||||
c = self.read(1)
|
||||
if not c:
|
||||
break
|
||||
s = s + c
|
||||
if c == (b"\n" if "b" in self.fh.mode else "\n"):
|
||||
if c == newline_character:
|
||||
break
|
||||
return s
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user