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);