From f9fe4da8b252dab9f3756c4b93793c781f836377 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sun, 25 Oct 2015 14:49:52 +0000 Subject: [PATCH] Make IFDRational hashable --- PIL/TiffImagePlugin.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 18793982d..ee5bd098a 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -283,12 +283,16 @@ class IFDRational(Fraction): def __repr__(self): return str(float(self._val)) + def __hash__(self): + return self._val.__hash__() + 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):