From 67f83c6efd1377cc0d1af56f4324c14cb23abde6 Mon Sep 17 00:00:00 2001 From: thejesh Date: Mon, 13 Jul 2026 20:05:26 -0700 Subject: [PATCH 1/2] maths/greatest_common_divisor: fix Python 3 except syntax `except IndexError, UnboundLocalError, ValueError:` is Python 2 syntax and raises SyntaxError under Python 3. The module currently fails to import at all, and downstream modules that depend on it (maths.least_common_multiple, maths.primelib) also fail with ImportError. Restore the parenthesised tuple form `except (IndexError, UnboundLocalError, ValueError):`, which was the correct form before a recent pre-commit autoupdate stripped the parentheses. Co-Authored-By: Claude Opus 4.7 (1M context) --- maths/greatest_common_divisor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/greatest_common_divisor.py b/maths/greatest_common_divisor.py index ce0abc664cf9..1fc123fc2b14 100644 --- a/maths/greatest_common_divisor.py +++ b/maths/greatest_common_divisor.py @@ -73,7 +73,7 @@ def main(): f"{greatest_common_divisor(num_1, num_2)}" ) print(f"By iterative gcd({num_1}, {num_2}) = {gcd_by_iterative(num_1, num_2)}") - except IndexError, UnboundLocalError, ValueError: + except (IndexError, UnboundLocalError, ValueError): print("Wrong input") From bcfa7aff3f877fc8075111867ce2f7b9aaaf7385 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 03:07:14 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/greatest_common_divisor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/greatest_common_divisor.py b/maths/greatest_common_divisor.py index 1fc123fc2b14..ce0abc664cf9 100644 --- a/maths/greatest_common_divisor.py +++ b/maths/greatest_common_divisor.py @@ -73,7 +73,7 @@ def main(): f"{greatest_common_divisor(num_1, num_2)}" ) print(f"By iterative gcd({num_1}, {num_2}) = {gcd_by_iterative(num_1, num_2)}") - except (IndexError, UnboundLocalError, ValueError): + except IndexError, UnboundLocalError, ValueError: print("Wrong input")