summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-02-07 22:42:51 (GMT)
committerGitHub <noreply@github.com>2020-02-07 22:42:51 (GMT)
commitdc7a50d73a3d16918529669ff7b8783c08cff090 (patch)
tree03dd057164d756447338063473d5559a1fc9c957 /Doc
parent60ac6ed5579f6666130fc264d3b748ee9575e3aa (diff)
downloadcpython-dc7a50d73a3d16918529669ff7b8783c08cff090.zip
cpython-dc7a50d73a3d16918529669ff7b8783c08cff090.tar.gz
cpython-dc7a50d73a3d16918529669ff7b8783c08cff090.tar.bz2
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.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/fractions.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst
index d3a4276..a4d006e 100644
--- a/Doc/library/fractions.rst
+++ b/Doc/library/fractions.rst
@@ -84,6 +84,10 @@ another rational number, or from a string.
The :class:`Fraction` constructor now accepts :class:`float` and
:class:`decimal.Decimal` instances.
+ .. versionchanged:: 3.9
+ The :func:`math.gcd` function is now used to normalize the *numerator*
+ and *denominator*. :func:`math.gcd` always return a :class:`int` type.
+ Previously, the GCD type depended on *numerator* and *denominator*.
.. attribute:: numerator