Changed ImageMath.ops to be static by radarhere · Pull Request #7721 · python-pillow/Pillow
Ah, that's right, temporarily commenting one one:
diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index a7652f237..47e552d3a 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -231,7 +231,7 @@ ops = { "notequal": imagemath_notequal, "min": imagemath_min, "max": imagemath_max, - "convert": imagemath_convert, + # "convert": imagemath_convert, }
Fails like this:
Tests/test_imagemath.py ........F.................. [100%]
=============================================================== FAILURES ===============================================================
_____________________________________________________________ test_convert _____________________________________________________________
def test_convert():
> assert pixel(ImageMath.eval("convert(A+B, 'L')", images)) == "L 3"
Tests/test_imagemath.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/PIL/ImageMath.py:276: in eval
scan(compiled_code)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
code = <code object <module> at 0x107002f70, file "<string>", line 1>
def scan(code: CodeType) -> None:
for const in code.co_consts:
if type(const) is type(compiled_code):
scan(const)
for name in code.co_names:
if name not in args and name != "abs":
msg = f"'{name}' not allowed"
> raise ValueError(msg)
E ValueError: 'convert' not allowed
src/PIL/ImageMath.py:274: ValueError
======================================================= short test summary info ========================================================
FAILED Tests/test_imagemath.py::test_convert - ValueError: 'convert' not allowed
===================================================== 1 failed, 26 passed in 1.80s =====================================================