This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bad error message from Decimal('garbage') across the py3 range
Type: enhancement Stage: resolved
Components: Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder: decimal C module's exceptions don't match the Python version
View: 26208
Assigned To: Nosy List: Samuele Santi, skrah
Priority: normal Keywords:

Created on 2016-09-02 16:31 by Samuele Santi, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test-decimal-error-output.txt Samuele Santi, 2016-09-02 16:31
Messages (2)
msg274254 - (view) Author: Samuele Santi (Samuele Santi) Date: 2016-09-02 16:31
Looks like, on some occasions, running ``Decimal('garbage')`` on Python 3.x decimal raises this error:

    decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

instead of the usual:

    decimal.InvalidOperation: Invalid literal for Decimal: 'garbage'


This seems to be caused by the built-in decimal module on 3.x, while it's just fine with decimal.py / _pydecimal.py (eg. the system Python on Archlinux).

I'm attaching the output from a few tests I made against different interpreters.
msg274259 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2016-09-02 16:53
Hardly a bad error message, but see #26208.
History
Date User Action Args
2022-04-11 14:58:35adminsetgithub: 72128
2016-09-02 16:53:05skrahsetstatus: open -> closed

superseder: decimal C module's exceptions don't match the Python version
nosy: + skrah

messages: + msg274259
type: behavior -> enhancement
resolution: duplicate
stage: resolved
2016-09-02 16:31:27Samuele Santicreate