diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py index 1cb4e2c9f..3cf214edd 100644 --- a/PIL/TiffImagePlugin.py +++ b/PIL/TiffImagePlugin.py @@ -237,7 +237,7 @@ class IFDRational(Rational): """ - __slots__ = ('numerator', 'denominator', '_val') + __slots__ = ('_numerator', '_denominator', '_val') def __init__(self, value, denominator=1): """ @@ -245,18 +245,18 @@ class IFDRational(Rational): float/rational/other number, or an IFDRational :param denominator: Optional integer denominator """ - self.denominator = denominator - self.numerator = value + self._denominator = denominator + self._numerator = value self._val = float(1) if type(value) == Fraction: - self.numerator = value.numerator - self.denominator = value.denominator + self._numerator = value.numerator + self._denominator = value.denominator self._val = value if type(value) == IFDRational: - self.denominator = value.denominator - self.numerator = value.numerator + self._denominator = value.denominator + self._numerator = value.numerator self._val = value._val return @@ -274,6 +274,14 @@ class IFDRational(Rational): else: self._val = Fraction(value, denominator) + @property + def numerator(a): + return a._numerator + + @property + def denominator(a): + return a._denominator + def limit_rational(self, max_denominator): """