[issue32466] Remove fractions._gcd()
Mark Dickinson
report at bugs.python.org
Sun Dec 31 11:08:06 EST 2017
Mark Dickinson <dickinsm at gmail.com> added the comment:
> [...] I cannot envision a scenario where that would be possible [...]
I don't think it can be ruled out. If I'm reading the code right, it's preceded by this branch of the initial if/elif chain:
elif (isinstance(numerator, numbers.Rational) and
isinstance(denominator, numbers.Rational)):
numerator, denominator = (
numerator.numerator * denominator.denominator,
denominator.numerator * numerator.denominator
)
I don't think there's any guarantee that if `numerator` is an instance of `numbers.Rational`, then `numerator.numerator` and `numerator.denominator` have exact type `int`. (Note that an instance of `numbers.Rational` is not necessarily an instance of `fractions.Fraction`.)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32466>
_______________________________________
More information about the Python-bugs-list
mailing list