From aba94d4a6101124db21b8e2243db36a31f2b93e3 Mon Sep 17 00:00:00 2001 From: Paul Becker Date: Thu, 12 Mar 2026 10:56:58 +0100 Subject: [PATCH 1/2] Fix division by zero Please enter the commit message for your changes. Lines starting --- Lib/fractions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/fractions.py b/Lib/fractions.py index c1b12e7a1c091c..a4bcb825017c49 100644 --- a/Lib/fractions.py +++ b/Lib/fractions.py @@ -203,7 +203,7 @@ class Fraction(numbers.Rational): __slots__ = ('_numerator', '_denominator') # We're immutable, so use __new__ not __init__ - def __new__(cls, numerator=0, denominator=None): + def __new__(cls, numerator=0, denominator=1): """Constructs a Rational. Takes a string like '3/2' or '1.5', another Rational instance, a From 6f0ff0305ab28fbcc98ef002443e51c928694a97 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 08:49:28 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/macOS/2026-03-13-08-49-26.gh-issue-145902.UiPZUw.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/macOS/2026-03-13-08-49-26.gh-issue-145902.UiPZUw.rst diff --git a/Misc/NEWS.d/next/macOS/2026-03-13-08-49-26.gh-issue-145902.UiPZUw.rst b/Misc/NEWS.d/next/macOS/2026-03-13-08-49-26.gh-issue-145902.UiPZUw.rst new file mode 100644 index 00000000000000..8208c4eb045f59 --- /dev/null +++ b/Misc/NEWS.d/next/macOS/2026-03-13-08-49-26.gh-issue-145902.UiPZUw.rst @@ -0,0 +1,2 @@ +Fix incorrect handling of division by zero so that Python consistently +raises ``ZeroDivisionError`` as expected.