Change max token size to 10

- ...so as not to reject "2,147,483,647" (2 ** 31 - 1);
- reword exception message.
This commit is contained in:
Piolie 2021-01-31 00:31:32 -03:00
parent bc5ecfb79c
commit 50522d932e

View File

@ -87,8 +87,8 @@ class PpmImageFile(ImageFile.ImageFile):
if c in B_WHITESPACE: # token ended if c in B_WHITESPACE: # token ended
break break
token += c token += c
if len(token) > 9: if len(token) > 10:
raise ValueError(f"Token too long: {token}") raise ValueError(f"Token too long in file header: {token}")
return token return token
def _open(self): def _open(self):