summaryrefslogtreecommitdiffstats
path: root/Lib/numbers.py
diff options
context:
space:
mode:
authorSergey B Kirpichev <skirpichev@gmail.com>2022-09-04 12:15:59 (GMT)
committerGitHub <noreply@github.com>2022-09-04 12:15:59 (GMT)
commit8464b754c4168586b99e2135ccd2567e025625a9 (patch)
treed4a79892904a7d853a10ed6b6e8dae5f5f428e54 /Lib/numbers.py
parent9b9394df5fa808f9a125e3e472e7df4c24aea5a1 (diff)
downloadcpython-8464b754c4168586b99e2135ccd2567e025625a9.zip
cpython-8464b754c4168586b99e2135ccd2567e025625a9.tar.gz
cpython-8464b754c4168586b99e2135ccd2567e025625a9.tar.bz2
gh-68163: Correct conversion of Rational instances to float (GH-25619)
* gh-68163: Correct conversion of Rational instances to float Also document that numerator/denominator properties are instances of Integral. Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Diffstat (limited to 'Lib/numbers.py')
-rw-r--r--Lib/numbers.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/numbers.py b/Lib/numbers.py
index 8e37d79..a2913e3 100644
--- a/Lib/numbers.py
+++ b/Lib/numbers.py
@@ -313,7 +313,7 @@ class Rational(Real):
so that ratios of huge integers convert without overflowing.
"""
- return self.numerator / self.denominator
+ return int(self.numerator) / int(self.denominator)
class Integral(Rational):