]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
statistics: Fix geometric_mean() error message for negative inputs (#149246)
authorhtjworld <116538001+htjworld@users.noreply.github.com>
Sat, 2 May 2026 03:54:24 +0000 (12:54 +0900)
committerGitHub <noreply@github.com>
Sat, 2 May 2026 03:54:24 +0000 (22:54 -0500)
Lib/statistics.py

index 32fcf2313a815a11d382f5e3eb26f02532979577..01ca6c51dafcafe7aa69567270619e6c4559956a 100644 (file)
@@ -248,7 +248,7 @@ def geometric_mean(data):
             elif x == 0.0:
                 found_zero = True
             else:
-                raise StatisticsError('No negative inputs allowed', x)
+                raise StatisticsError(f'No negative inputs allowed: {x!r}')
 
     total = fsum(map(log, count_positive(data)))