diff Lib/decimal.py @ 52201:fcdffd85a8bd

Merged revisions 70444 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70444 | mark.dickinson | 2009-03-18 08:22:51 +0000 (Wed, 18 Mar 2009) | 3 lines Fix bug in _insert_thousands_sep: too much zero padding could be added for 'n' formats with non-repeating thousands-separator. ........
author Mark Dickinson <dickinsm@gmail.com>
date Wed, 18 Mar 2009 08:25:36 +0000
parents 12e14e6f1f2d
children 696dd2281841
line wrap: on
line diff
--- a/Lib/decimal.py	Tue Mar 17 23:12:51 2009 +0000
+++ b/Lib/decimal.py	Wed Mar 18 08:25:36 2009 +0000
@@ -5690,8 +5690,6 @@
 
     groups = []
     for l in _group_lengths(grouping):
-        if groups:
-            min_width -= len(sep)
         if l <= 0:
             raise ValueError("group length should be positive")
         # max(..., 1) forces at least 1 digit to the left of a separator
@@ -5701,6 +5699,7 @@
         min_width -= l
         if not digits and min_width <= 0:
             break
+        min_width -= len(sep)
     else:
         l = max(len(digits), min_width, 1)
         groups.append('0'*(l - len(digits)) + digits[-l:])