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.

Author petr.viktorin
Recipients petr.viktorin, skrah
Date 2016-01-26.17:46:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1453830419.58.0.782557332566.issue26208@psf.upfronthosting.co.za>
In-reply-to
Content
Exceptions from the decimal module are quite unfriendly:

    >>> Decimal(42) / Decimal(0)
    ...
    decimal.DivisionByZero: [<class 'decimal.DivisionByZero'>]

    >>> huge = Decimal('9' * 99)
    >>> huge.quantize(Decimal('0.1'))
    ...
    decimal.InvalidOperation: [<class 'decimal.InvalidOperation'>]


compared to the pure Python implementation:

    decimal.DivisionByZero: x / 0

    decimal.InvalidOperation: quantize result has too many digits for current context


If I'm reading http://bugs.python.org/issue21227 right, the exception argument is a of signals, and indicates the complete set of signals raised by the operation. However, this is (AFAICS) not documented, and not portable (since it's not present in the Python version).

I believe this behavior should be
- either dropped in favor of friendlier error messages (or possibly moved to a more internal attribute of the exception, and documented as an optional CPython feature),
- or documented, and implemented in _pydecimal as well.

Which of those actions would be right seems to be a question of whether the exception argument is part of the API.
History
Date User Action Args
2016-01-26 17:46:59petr.viktorinsetrecipients: + petr.viktorin, skrah
2016-01-26 17:46:59petr.viktorinsetmessageid: <1453830419.58.0.782557332566.issue26208@psf.upfronthosting.co.za>
2016-01-26 17:46:59petr.viktorinlinkissue26208 messages
2016-01-26 17:46:59petr.viktorincreate