]> 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:14:37 +0000 (07:14 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Feb 2020 15:14:37 +0000 (07:14 -0800)
commit705d271d553b77fd170d27ab8d0f11f638c7f145
tree487542e8ec1179b1d5951065729348bc30135de6
parent6ba8dc6aae6fa0a7e29ba4ac18227beb38872392
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]