mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Only assign once
This commit is contained in:
parent
290189596e
commit
887a7e503c
|
@ -310,20 +310,18 @@ class IFDRational(Rational):
|
|||
float/rational/other number, or an IFDRational
|
||||
:param denominator: Optional integer denominator
|
||||
"""
|
||||
self._denominator = denominator
|
||||
self._numerator = value
|
||||
self._val = float(1)
|
||||
if isinstance(value, IFDRational):
|
||||
self._numerator = value.numerator
|
||||
self._denominator = value.denominator
|
||||
self._val = value._val
|
||||
return
|
||||
|
||||
if isinstance(value, Fraction):
|
||||
self._numerator = value.numerator
|
||||
self._denominator = value.denominator
|
||||
self._val = value
|
||||
|
||||
if isinstance(value, IFDRational):
|
||||
self._denominator = value.denominator
|
||||
self._numerator = value.numerator
|
||||
self._val = value._val
|
||||
return
|
||||
else:
|
||||
self._numerator = value
|
||||
self._denominator = denominator
|
||||
|
||||
if denominator == 0:
|
||||
self._val = float("nan")
|
||||
|
|
Loading…
Reference in New Issue
Block a user