From b6f6fba8cf170e60619da81ff1a24c2ef4364be5 Mon Sep 17 00:00:00 2001 From: Piolie Date: Wed, 13 Jan 2021 18:45:29 -0300 Subject: [PATCH] Rewrite `_ignore_comment` as one-liner --- src/PIL/PpmImagePlugin.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/PIL/PpmImagePlugin.py b/src/PIL/PpmImagePlugin.py index e25b4bcec..95987b4a4 100644 --- a/src/PIL/PpmImagePlugin.py +++ b/src/PIL/PpmImagePlugin.py @@ -61,10 +61,8 @@ class PpmImageFile(ImageFile.ImageFile): 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)