diff -r 0d948a46c59a Lib/statistics.py --- a/Lib/statistics.py Sun Oct 02 21:59:44 2016 +0300 +++ b/Lib/statistics.py Mon Oct 03 20:07:45 2016 +0900 @@ -561,10 +561,11 @@ def geometric_mean(data): errmsg = 'geometric mean does not support negative values' n = len(data) if n < 1: - raise StatisticsError('geometric_mean requires at least one data point') + raise StatisticsError( + 'geometric_mean requires at least one data point') elif n == 1: x = data[0] - if isinstance(g, (numbers.Real, Decimal)): + if isinstance(x, (numbers.Real, Decimal)): if x < 0: raise StatisticsError(errmsg) return x