[ python-Bugs-1770009 ] decimal.Decimal("trash") produces informationless exception
SourceForge.net
noreply at sourceforge.net
Wed Aug 8 14:44:32 CEST 2007
Bugs item #1770009, was opened at 2007-08-08 22:44
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1770009&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: John Machin (sjmachin)
Assigned to: Nobody/Anonymous (nobody)
Summary: decimal.Decimal("trash") produces informationless exception
Initial Comment:
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import decimal
>>> decimal.Decimal("-$123,456.78")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python25\lib\decimal.py", line 614, in __new__
self._sign, self._int, self._exp = context._raise_error(ConversionSyntax)
File "C:\python25\lib\decimal.py", line 2325, in _raise_error
raise error, explanation
decimal.InvalidOperation
It should do something like float does ... better message, and show the offending arg:
>>> float("-$123,456.78")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid literal for float(): -$123,456.78
>>>
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1770009&group_id=5470
More information about the Python-bugs-list
mailing list