[Python-checkins] r74704 - in python/trunk: Lib/decimal.py Lib/test/test_decimal.py Misc/NEWS

mark.dickinson python-checkins at python.org
Mon Sep 7 18:17:41 CEST 2009


Author: mark.dickinson
Date: Mon Sep 7 18:17:41 2009
New Revision: 74704
Log:
Issue #6850: Fix bug in Decimal._parse_format_specifier for formats
with no type specifier.
Modified:
 python/trunk/Lib/decimal.py
 python/trunk/Lib/test/test_decimal.py
 python/trunk/Misc/NEWS
Modified: python/trunk/Lib/decimal.py
==============================================================================
--- python/trunk/Lib/decimal.py	(original)
+++ python/trunk/Lib/decimal.py	Mon Sep 7 18:17:41 2009
@@ -5512,7 +5512,7 @@
 # if format type is 'g' or 'G' then a precision of 0 makes little
 # sense; convert it to 1. Same if format type is unspecified.
 if format_dict['precision'] == 0:
- if format_dict['type'] in 'gG' or format_dict['type'] is None:
+ if format_dict['type'] is None or format_dict['type'] in 'gG':
 format_dict['precision'] = 1
 
 # determine thousands separator, grouping, and decimal separator, and
Modified: python/trunk/Lib/test/test_decimal.py
==============================================================================
--- python/trunk/Lib/test/test_decimal.py	(original)
+++ python/trunk/Lib/test/test_decimal.py	Mon Sep 7 18:17:41 2009
@@ -760,6 +760,9 @@
 (',%', '123.456789', '12,345.6789%'),
 (',e', '123456', '1.23456e+5'),
 (',E', '123456', '1.23456E+5'),
+
+ # issue 6850
+ ('a=-7.0', '0.12345', 'aaaa0.1'),
 ]
 for fmt, d, result in test_values:
 self.assertEqual(format(Decimal(d), fmt), result)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Sep 7 18:17:41 2009
@@ -366,6 +366,9 @@
 Library
 -------
 
+- Issue #6850: Fix bug in Decimal._parse_format_specifier for formats
+ with no type specifier.
+
 - Issue #4937: plat-mac/bundlebuilder revers to non-existing version.plist
 
 - Issue #6838: Use a list to accumulate the value instead of


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /