mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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:
parent
e7eee01f36
commit
0774e9b9f5
3 changed files with 27 additions and 2 deletions
|
@ -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]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue