]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 6 Feb 2020 15:13:38 +0000 (07:13 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 15:13:38 +0000 (07:13 -0800)
commit0d03a1028200646479ef9bb0ad8973d0e73f9525
tree98bdca24fac5745d2f0802d37499d35769cc9005
parent708f472dd92f4f46c27ace710492da65da4a3319
bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)

Some numerator types used (specifically NumPy) decides to not
return a Python boolean for the "a != b" operation. Using the equivalent
call to bool() guarantees a bool return also for such types.
(cherry picked from commit 427c84f13f7719e6014a21bd1b81efdc02a046fb)

Co-authored-by: Sebastian Berg <sebastian@sipsolutions.net>
Lib/fractions.py
Lib/test/test_fractions.py
Misc/NEWS.d/next/Library/2020-01-15-23-13-03.bpo-39274.lpc0-n.rst [new file with mode: 0644]