From c6c1d7c11a6f6da87f4de9af894aa3d468666e5e Mon Sep 17 00:00:00 2001 From: luphord Date: Fri, 24 Jul 2020 16:17:15 +0200 Subject: [PATCH] fix IFDRational equality --- src/PIL/TiffImagePlugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py index cb925246d..9ca7bf1cd 100644 --- a/src/PIL/TiffImagePlugin.py +++ b/src/PIL/TiffImagePlugin.py @@ -354,6 +354,9 @@ class IFDRational(Rational): def __eq__(self, other): if isinstance(other, IFDRational): + if self.denominator == 0 and other.denominator == 0: + # in this case self._val and other._val would be NaN + return self.numerator == other.numerator other = other._val return self._val == other