Skip to content

Commit

Permalink
Use isinstance to detect Image instances
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Sep 10, 2024
1 parent e0845f0 commit adb6918
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PIL/ImageMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def lambda_eval(
args.update(options)
args.update(kw)
for k, v in args.items():
if hasattr(v, "im"):
if isinstance(v, Image.Image):
args[k] = _Operand(v)

out = expression(args)
Expand Down Expand Up @@ -319,7 +319,7 @@ def unsafe_eval(
args.update(options)
args.update(kw)
for k, v in args.items():
if hasattr(v, "im"):
if isinstance(v, Image.Image):
args[k] = _Operand(v)

compiled_code = compile(expression, "<string>", "eval")
Expand Down

0 comments on commit adb6918

Please sign in to comment.