diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-03-18 08:25:36 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-03-18 08:25:36 (GMT) |
commit | 7303b594e62349251cbb9d98141a96885fc88e6f (patch) | |
tree | f38c0d29fab1e3357b65fe9e1c2b91ea5f0a5bb8 /Lib/decimal.py | |
parent | 79f52039fe181d0f98b056b0b312a9bb42a59526 (diff) | |
download | cpython-7303b594e62349251cbb9d98141a96885fc88e6f.zip cpython-7303b594e62349251cbb9d98141a96885fc88e6f.tar.gz cpython-7303b594e62349251cbb9d98141a96885fc88e6f.tar.bz2 |
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.
........
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r-- | Lib/decimal.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index a751aa8..af29e68 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -5690,8 +5690,6 @@ def _insert_thousands_sep(digits, spec, min_width=1): 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 @@ def _insert_thousands_sep(digits, spec, min_width=1): 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:]) |