Skip to content

Commit

Permalink
For effiency, set newline character outside of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Feb 15, 2020
1 parent cb298e3 commit 0bb1a8b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/PIL/ContainerIO.py
Expand Up @@ -93,12 +93,13 @@ def readline(self):
:returns: An 8-bit string.
"""
s = b"" if "b" in self.fh.mode else ""
newLineCharacter = 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 == newLineCharacter:

This comment has been minimized.

Copy link
@hugovk

hugovk Feb 15, 2020

Member

Let's snake case this

break
return s

Expand Down

0 comments on commit 0bb1a8b

Please sign in to comment.