]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-39350: Fix fractions for int subclasses (GH-18375)
authorVictor Stinner <vstinner@python.org>
Fri, 7 Feb 2020 22:42:51 +0000 (23:42 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2020 22:42:51 +0000 (23:42 +0100)
commitdc7a50d73a3d16918529669ff7b8783c08cff090
tree03dd057164d756447338063473d5559a1fc9c957
parent60ac6ed5579f6666130fc264d3b748ee9575e3aa
bpo-39350: Fix fractions for int subclasses (GH-18375)

Fix regression in fractions.Fraction if the numerator and/or the
denominator is an int subclass. The math.gcd() function is now
used to normalize the numerator and denominator. math.gcd() always
return a int type. Previously, the GCD type depended on numerator
and denominator.
Doc/library/fractions.rst
Lib/fractions.py
Lib/test/test_fractions.py
Misc/NEWS.d/next/Library/2020-02-06-13-34-52.bpo-39350.wRwup1.rst [new file with mode: 0644]