From 3bbb9e676ff09a7a62c45175cf86fba31e279f6f Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sun, 25 Oct 2015 14:17:50 +0000 Subject: [PATCH] value based equivalence --- PIL/TiffImagePlugin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 0e6efc416..18793982d 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -282,6 +282,13 @@ class IFDRational(Fraction): def __repr__(self): return str(float(self._val)) + + def __eq__(self,other): + if type(other) == float: + return float(self) == other + if type(other) == int: + return float(self) == float(int(self)) and int(self) == other + return float(self) == float(other) class ImageFileDirectory_v2(collections.MutableMapping):