https://github.com/python/cpython/commit/0f5cd57f80a704e67b8566f8cf5686d300db28c3
commit: 0f5cd57f80a704e67b8566f8cf5686d300db28c3
branch: main
author: htjworld <[email protected]>
committer: rhettinger <[email protected]>
date: 2026-05-01T22:54:24-05:00
summary:

statistics: Fix geometric_mean() error message for negative inputs (#149246)

files:
M Lib/statistics.py

diff --git a/Lib/statistics.py b/Lib/statistics.py
index 32fcf2313a815a..01ca6c51dafcaf 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -248,7 +248,7 @@ def count_positive(iterable):
             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)))
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to