Skip to content

Commit adb6918

Browse files
committed
Use isinstance to detect Image instances
1 parent e0845f0 commit adb6918

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/PIL/ImageMath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def lambda_eval(
268268
args.update(options)
269269
args.update(kw)
270270
for k, v in args.items():
271-
if hasattr(v, "im"):
271+
if isinstance(v, Image.Image):
272272
args[k] = _Operand(v)
273273

274274
out = expression(args)
@@ -319,7 +319,7 @@ def unsafe_eval(
319319
args.update(options)
320320
args.update(kw)
321321
for k, v in args.items():
322-
if hasattr(v, "im"):
322+
if isinstance(v, Image.Image):
323323
args[k] = _Operand(v)
324324

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

0 commit comments

Comments
 (0)