Raise InvalidOperation if exponents of zeros are clamped during exact

conversion in the Decimal constructor. Exact here refers to the
representation and not to the value (clamping does not change the value).
This commit is contained in:
Stefan Krah 2012-04-05 15:21:58 +02:00
parent e7eee01f36
commit 0774e9b9f5
3 changed files with 27 additions and 2 deletions

View file

@ -302,6 +302,7 @@ def RestrictedDecimal(value):
dec = maxcontext.create_decimal(value)
if maxcontext.flags[P.Inexact] or \
maxcontext.flags[P.Rounded] or \
maxcontext.flags[P.Clamped] or \
maxcontext.flags[P.InvalidOperation]:
return context.p._raise_error(P.InvalidOperation)
if maxcontext.flags[P.FloatOperation]: