mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Merge pull request #6239 from radarhere/ppm_token
Decode bytes before passing to f-string
This commit is contained in:
commit
42a81c4173
|
@ -123,7 +123,7 @@ def test_token_too_long(tmp_path):
|
||||||
with Image.open(path):
|
with Image.open(path):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
assert str(e.value) == "Token too long in file header: b'01234567890'"
|
assert str(e.value) == "Token too long in file header: 01234567890"
|
||||||
|
|
||||||
|
|
||||||
def test_truncated_file(tmp_path):
|
def test_truncated_file(tmp_path):
|
||||||
|
|
|
@ -83,7 +83,7 @@ class PpmImageFile(ImageFile.ImageFile):
|
||||||
# Token was not even 1 byte
|
# Token was not even 1 byte
|
||||||
raise ValueError("Reached EOF while reading header")
|
raise ValueError("Reached EOF while reading header")
|
||||||
elif len(token) > 10:
|
elif len(token) > 10:
|
||||||
raise ValueError(f"Token too long in file header: {token}")
|
raise ValueError(f"Token too long in file header: {token.decode()}")
|
||||||
return token
|
return token
|
||||||
|
|
||||||
def _open(self):
|
def _open(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user