mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-02 23:13:40 +03:00
Retain variable case for backwards compatibility
This commit is contained in:
parent
e2e87d73c3
commit
cb4e26783f
|
@ -20,7 +20,7 @@ from . import Image, ImageFile
|
||||||
#
|
#
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
|
||||||
B_WHITESPACE = b"\x20\x09\x0a\x0b\x0c\x0d"
|
b_whitespace = b"\x20\x09\x0a\x0b\x0c\x0d"
|
||||||
|
|
||||||
MODES = {
|
MODES = {
|
||||||
# standard
|
# standard
|
||||||
|
@ -52,7 +52,7 @@ class PpmImageFile(ImageFile.ImageFile):
|
||||||
def _read_magic(self, magic=b""):
|
def _read_magic(self, magic=b""):
|
||||||
while True: # read until next whitespace
|
while True: # read until next whitespace
|
||||||
c = self.fp.read(1)
|
c = self.fp.read(1)
|
||||||
if c in B_WHITESPACE:
|
if c in b_whitespace:
|
||||||
break
|
break
|
||||||
magic += c
|
magic += c
|
||||||
if len(magic) > 6: # exceeded max magic number length
|
if len(magic) > 6: # exceeded max magic number length
|
||||||
|
@ -69,7 +69,7 @@ class PpmImageFile(ImageFile.ImageFile):
|
||||||
if c == b"#": # found comment, ignore it
|
if c == b"#": # found comment, ignore it
|
||||||
_ignore_comment()
|
_ignore_comment()
|
||||||
continue
|
continue
|
||||||
if c in B_WHITESPACE: # found whitespace, ignore it
|
if c in b_whitespace: # found whitespace, ignore it
|
||||||
if c == b"": # reached EOF
|
if c == b"": # reached EOF
|
||||||
raise ValueError("Reached EOF while reading header")
|
raise ValueError("Reached EOF while reading header")
|
||||||
continue
|
continue
|
||||||
|
@ -82,7 +82,7 @@ class PpmImageFile(ImageFile.ImageFile):
|
||||||
if c == b"#":
|
if c == b"#":
|
||||||
_ignore_comment()
|
_ignore_comment()
|
||||||
continue
|
continue
|
||||||
if c in B_WHITESPACE: # token ended
|
if c in b_whitespace: # token ended
|
||||||
break
|
break
|
||||||
token += c
|
token += c
|
||||||
if len(token) > 10:
|
if len(token) > 10:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user