diff --git a/Tests/oss-fuzz/build.sh b/Tests/oss-fuzz/build.sh index 37fad7bc8..3aa6c7f6a 100755 --- a/Tests/oss-fuzz/build.sh +++ b/Tests/oss-fuzz/build.sh @@ -15,7 +15,7 @@ # ################################################################################ -python3 setup.py build --build-base=/tmp/build install +python3 -m pip install . # Build fuzzers in $OUT. for fuzzer in $(find $SRC -name 'fuzz_*.py'); do diff --git a/Tests/test_imageops.py b/Tests/test_imageops.py index 6d153ccea..a3bb536ce 100644 --- a/Tests/test_imageops.py +++ b/Tests/test_imageops.py @@ -433,6 +433,12 @@ def test_exif_transpose_in_place(): assert_image_equal(im, expected) +def test_autocontrast_unsupported_mode(): + im = Image.new("RGBA", (1, 1)) + with pytest.raises(OSError): + ImageOps.autocontrast(im) + + def test_autocontrast_cutoff(): # Test the cutoff argument of autocontrast with Image.open("Tests/images/bw_gradient.png") as img: diff --git a/src/PIL/ImageOps.py b/src/PIL/ImageOps.py index 6d70f0248..4f83a4edb 100644 --- a/src/PIL/ImageOps.py +++ b/src/PIL/ImageOps.py @@ -56,7 +56,7 @@ def _lut(image, lut): lut = lut + lut + lut return image.point(lut) else: - msg = "not supported for this image mode" + msg = f"not supported for mode {image.mode}" raise OSError(msg)