Skip to content

Commit

Permalink
Rewrite _ignore_comment as one-liner
Browse files Browse the repository at this point in the history
  • Loading branch information
Piolie committed Jan 31, 2021
1 parent b43654d commit b6f6fba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/PIL/PpmImagePlugin.py
Expand Up @@ -61,10 +61,8 @@ def _read_magic(self, magic=b""):

def _read_token(self, token=b""):
def _ignore_comment(): # ignores rest of the line; stops at CR, LF or EOF
while True:
c = self.fp.read(1)
if c in b"\r\n":
break
while self.fp.read(1) not in b"\r\n":
pass

while True: # read until non-whitespace is found
c = self.fp.read(1)
Expand Down

0 comments on commit b6f6fba

Please sign in to comment.