summaryrefslogtreecommitdiff
path: root/Lib/fractions.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fractions.py')
-rw-r--r--Lib/fractions.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/fractions.py b/Lib/fractions.py
index 501f4b74a0..f5a854414c 100644
--- a/Lib/fractions.py
+++ b/Lib/fractions.py
@@ -625,7 +625,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