Skip to content

Commit 67f83c6

Browse files
thejesh23claude
andcommitted
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) <noreply@anthropic.com>
1 parent c0db072 commit 67f83c6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

maths/greatest_common_divisor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def main():
7373
f"{greatest_common_divisor(num_1, num_2)}"
7474
)
7575
print(f"By iterative gcd({num_1}, {num_2}) = {gcd_by_iterative(num_1, num_2)}")
76-
except IndexError, UnboundLocalError, ValueError:
76+
except (IndexError, UnboundLocalError, ValueError):
7777
print("Wrong input")
7878

7979

0 commit comments

Comments
 (0)