mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-12 16:55:47 +03:00
Do not add palette entries when reading other lines
This commit is contained in:
parent
9c8c7a0a4e
commit
d76d45a28e
|
@ -32,4 +32,4 @@ def test_get_palette() -> None:
|
|||
|
||||
# Assert
|
||||
assert mode == "RGB"
|
||||
assert len(palette) / 3 == 11
|
||||
assert len(palette) / 3 == 8
|
||||
|
|
|
@ -32,14 +32,13 @@ class GimpPaletteFile:
|
|||
raise SyntaxError(msg)
|
||||
|
||||
palette: list[int] = []
|
||||
for i in range(256):
|
||||
for _ in range(256):
|
||||
s = fp.readline()
|
||||
if not s:
|
||||
break
|
||||
|
||||
# skip fields and comment lines
|
||||
if re.match(rb"\w+:|#", s):
|
||||
palette.append(o8(i) * 3)
|
||||
continue
|
||||
if len(s) > 100:
|
||||
msg = "bad palette file"
|
||||
|
|
Loading…
Reference in New Issue
Block a user