diff options
Diffstat (limited to 'lib-python/3/fractions.py')
-rw-r--r-- | lib-python/3/fractions.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib-python/3/fractions.py b/lib-python/3/fractions.py index 79fa4d7126..e5770e2e21 100644 --- a/lib-python/3/fractions.py +++ b/lib-python/3/fractions.py @@ -636,7 +636,9 @@ class Fraction(numbers.Rational): def __bool__(a): """a != 0""" - return a._numerator != 0 + # bpo-39274: Use bool() because (a._numerator != 0) can return an + # object which is not a bool. + return bool(a._numerator) # support for pickling, copy, and deepcopy |