Message92337
Hi,
it looks like format_dict['type'] is not always initialized:
>>> from decimal import *
>>> format(Decimal("0.12345"), "a=-7.0")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.1/decimal.py", line 3611, in __format__
spec = _parse_format_specifier(specifier, _localeconv=_localeconv)
File "/usr/lib/python3.1/decimal.py", line 5595, in
_parse_format_specifier
if format_dict['type'] in 'gG' or format_dict['type'] is None:
TypeError: 'in <string>' requires string as left operand, not NoneType
Inserting these two lines somewhere in _parse_format_specifier fixes the
problem. (float() uses 'g' as the default, but I got the impression that
decimal.py uses uppercase as the default.)
if format_dict['type'] is None:
format_dict['type'] = 'G' |
|
Date |
User |
Action |
Args |
2009-09-06 21:34:28 | skrah | set | recipients:
+ skrah |
2009-09-06 21:34:28 | skrah | set | messageid: <1252272868.18.0.127348789237.issue6850@psf.upfronthosting.co.za> |
2009-09-06 21:34:26 | skrah | link | issue6850 messages |
2009-09-06 21:34:26 | skrah | create | |
|