-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Labels
bugThis issue is a confirmed bug.This issue is a confirmed bug.dynamodbp3This is a minor priority issueThis is a minor priority issue
Description
Describe the bug
This was previously reported at #2500 but that issue was closed and the actions bot recommends creating a new issue which references that.
A number like 1234567895171680000000000000000000000000 is valid in DynamoDB and we're happily persisting such numbers using the golang sdk. But boto3 blows up trying to fetch an item with such a number because it treats the zeros as significant digits.
DYNAMODB_CONTEXT = Context(
Emin=-128,
Emax=126,
prec=38,
traps=[Clamped, Overflow, Inexact, Rounded, Underflow],
)
...
def _deserialize_n(self, value):
return DYNAMODB_CONTEXT.create_decimal(value)Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Numbers like 1234567895171680000000000000000000000000 are valid in DynamoDB and should be parseable by boto3
Current Behavior
Traceback (most recent call last):
File "<console>", line 1, in <module>
decimal.Rounded: [<class 'decimal.Rounded'>]
Reproduction Steps
from boto3.dynamodb.types import DYNAMODB_CONTEXT
DYNAMODB_CONTEXT.create_decimal("1234567895171680000000000000000000000000")
Possible Solution
I think it could be fixed using normalize, i.e.
def _deserialize_n(self, value):
return DYNAMODB_CONTEXT.create_decimal(Decimal(value).normalize())Additional Information/Context
No response
SDK version used
1.42.23
Environment details (OS name and version, etc.)
MacOS and Ubuntu
Metadata
Metadata
Assignees
Labels
bugThis issue is a confirmed bug.This issue is a confirmed bug.dynamodbp3This is a minor priority issueThis is a minor priority issue