Skip OverflowError on Windows Python 3.10

This commit is contained in:
Andrew Murray 2026-02-18 23:24:05 +11:00 committed by Hugo van Kemenade
parent 4bada07dc6
commit 591ce38ca5

View File

@ -1,12 +1,19 @@
from __future__ import annotations
import sys
import warnings
import pytest
from PIL import Image, PsdImagePlugin
from .helper import assert_image_equal_tofile, assert_image_similar, hopper, is_pypy
from .helper import (
assert_image_equal_tofile,
assert_image_similar,
hopper,
is_pypy,
is_win32,
)
test_file = "Tests/images/hopper.psd"
@ -195,11 +202,23 @@ def test_layer_crashes(test_file: str) -> None:
"Tests/images/psd-oob-write.psd",
"Tests/images/psd-oob-write-x.psd",
"Tests/images/psd-oob-write-y.psd",
"Tests/images/psd-oob-write-overflow.psd",
],
)
def test_bounds_crash(test_file: str) -> None:
with Image.open(test_file) as im:
assert isinstance(im, PsdImagePlugin.PsdImageFile)
im.seek(im.n_frames)
with pytest.raises(ValueError):
im.load()
@pytest.mark.skipif(
is_win32() and sys.version_info < (3, 11),
reason="OverflowError on Windows Python 3.10",
)
def test_bounds_crash_overflow() -> None:
with Image.open("Tests/images/psd-oob-write-overflow.psd") as im:
assert isinstance(im, PsdImagePlugin.PsdImageFile)
im.load()
im.seek(im.n_frames)