Reverted NaN change, so that NaN != NaN

This commit is contained in:
Andrew Murray 2020-08-28 20:55:47 +10:00
parent 4bb35c57dd
commit 0a46cbfea9
2 changed files with 2 additions and 13 deletions

View File

@ -30,7 +30,6 @@ def test_sanity():
def test_ranges():
for num in range(1, 10):
for denom in range(1, 10):
assert IFDRational(num, denom) == IFDRational(num, denom)
@ -50,12 +49,6 @@ def test_nonetype():
assert xres and yres
def test_nan():
# usually NaN != NaN, but this would break exif self-equality
assert IFDRational(123, 0) == IFDRational(123, 0)
def test_ifd_rational_save(tmp_path):
methods = (True, False)
if not features.check("libtiff"):

View File

@ -354,12 +354,8 @@ 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
return self._val == other._val
else:
return self._val == other
other = other._val
return self._val == other
def _delegate(op):
def delegate(self, *args):