python-pillow / Pillow

Python Imaging Library (Fork)

Home Page:https://python-pillow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ImageMath.eval` deprecation warning running `selftest.py`

hugovk opened this issue · comments

During the release, make release-test runs python3 selftest.py:

python3 selftest.py
...
Running selftest:
<doctest __main__.testimage[57]>:1: DeprecationWarning: ImageMath.eval is deprecated and will be removed in Pillow 12 (2025-10-15). Use ImageMath.lambda_eval or ImageMath.unsafe_eval instead.
  im = ImageMath.eval("float(im + 20)", im=im.convert("L"))
--- 59 tests passed.

Here's the eval:

>>> im = ImageMath.eval("float(im + 20)", im=im.convert("L"))

Shall we rewrite it as lambda_eval, catch the deprecation warning, or just remove it?

Rewriting it with lambda_eval would be my suggestion. #7960