[Python-checkins] r70432 - in python/branches/py3k: Lib/decimal.py Lib/test/test_decimal.py Misc/NEWS
mark.dickinson
python-checkins at python.org
Tue Mar 17 19:10:15 CET 2009
Author: mark.dickinson
Date: Tue Mar 17 19:10:15 2009
New Revision: 70432
Log:
Merged revisions 70430 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70430 | mark.dickinson | 2009-03-17 18:01:03 +0000 (Tue, 17 Mar 2009) | 3 lines
Fix bug in Decimal __format__ method that swapped left and right
alignment.
........
Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Lib/decimal.py
python/branches/py3k/Lib/test/test_decimal.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/decimal.py
==============================================================================
--- python/branches/py3k/Lib/decimal.py (original)
+++ python/branches/py3k/Lib/decimal.py Tue Mar 17 19:10:15 2009
@@ -5630,9 +5630,9 @@
align = spec_dict['align']
if align == '<':
- result = padding + sign + body
- elif align == '>':
result = sign + body + padding
+ elif align == '>':
+ result = padding + sign + body
elif align == '=':
result = sign + padding + body
else: #align == '^'
Modified: python/branches/py3k/Lib/test/test_decimal.py
==============================================================================
--- python/branches/py3k/Lib/test/test_decimal.py (original)
+++ python/branches/py3k/Lib/test/test_decimal.py Tue Mar 17 19:10:15 2009
@@ -693,6 +693,12 @@
('.0g', '-sNaN', '-sNaN'),
('', '1.00', '1.00'),
+
+ # check alignment
+ ('<6', '123', '123 '),
+ ('>6', '123', ' 123'),
+ ('^6', '123', ' 123 '),
+ ('=+6', '123', '+ 123'),
]
for fmt, d, result in test_values:
self.assertEqual(format(Decimal(d), fmt), result)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Tue Mar 17 19:10:15 2009
@@ -206,6 +206,9 @@
Library
-------
+- Fix Decimal.__format__ bug that swapped the meanings of the '<' and
+ '>' alignment characters.
+
- Issue #1222: locale.format() bug when the thousands separator is a space
character.
More information about the Python-checkins
mailing list