From 6c2c7452da91526547f05d10cf563db21965e3a3 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 12 Aug 2026 22:51:24 +1000 Subject: [PATCH] Add error message --- Tests/test_imagewin.py | 2 +- src/display.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/test_imagewin.py b/Tests/test_imagewin.py index df50478a2c4..80126d4d029 100644 --- a/Tests/test_imagewin.py +++ b/Tests/test_imagewin.py @@ -101,7 +101,7 @@ def test_dib_paste_bbox(self) -> None: # Assert assert dib.size == (128, 128) - with pytest.raises(ValueError, match="images do not match"): + with pytest.raises(ValueError, match="box must match image size"): dib.paste(im, (0, 0, 1, 1)) def test_dib_frombytes_tobytes_roundtrip(self) -> None: diff --git a/src/display.c b/src/display.c index 4a2d9d9b256..e84f0a8b652 100644 --- a/src/display.c +++ b/src/display.c @@ -135,12 +135,12 @@ _paste(ImagingDisplayObject *display, PyObject *args) { if (xy[2] <= xy[0]) { xy[2] = xy[0] + im->xsize; } else if (xy[2] - xy[0] != im->xsize) { - return ImagingError_Mismatch(); + return ImagingError_Mismatch("box must match image size"); } if (xy[3] <= xy[1]) { xy[3] = xy[1] + im->ysize; } else if (xy[3] - xy[1] != im->ysize) { - return ImagingError_Mismatch(); + return ImagingError_Mismatch("box must match image size"); } ImagingPasteDIB(display->dib, im, xy);