mirror of
https://github.com/python-pillow/Pillow.git
synced 2026-02-04 06:25:52 +03:00
Merge 400ffbc18d into 62aa42f9da
This commit is contained in:
commit
68d088224b
|
|
@ -85,6 +85,11 @@ def test_eoferror() -> None:
|
|||
# Test that seeking to the last frame does not raise an error
|
||||
im.seek(n_frames - 1)
|
||||
|
||||
# Test seeking past the last frame without calling n_frames first
|
||||
with Image.open(test_file) as im:
|
||||
with pytest.raises(EOFError):
|
||||
im.seek(3)
|
||||
|
||||
|
||||
def test_seek_tell() -> None:
|
||||
with Image.open(test_file) as im:
|
||||
|
|
|
|||
|
|
@ -175,6 +175,9 @@ class PsdImageFile(ImageFile.ImageFile):
|
|||
raise self._fp.ex
|
||||
|
||||
# seek to given layer (1..max)
|
||||
if layer > len(self.layers):
|
||||
msg = "no more images in PSD file"
|
||||
raise EOFError(msg)
|
||||
_, mode, _, tile = self.layers[layer - 1]
|
||||
self._mode = mode
|
||||
self.tile = tile
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user