You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pydantic throws a ValidationError when converting a Decimal of an int to int. Not sure if this is the expected behavior.
fromdecimalimportDecimalfrompydanticimportBaseModelclassA(BaseModel):
a: intA(a=10000000000000000000) # this worksA(a=Decimal('10000000000000000000')) # this doesn't
ValidationError: 1 validation error for A
a
Unable to parse input string as an integer, exceeded maximum size [type=int_parsing_size, input_value=Decimal('10000000000000000000'), input_type=Decimal]
For further information visit https://errors.pydantic.dev/2.3/v/int_parsing_size
It looks like what's happening here is that the Decimal is getting converted to a float first and then trying to be pushed into a float64. We'll need to fix this on the pydantic-core side.
Initial Checks
Description
Hello 馃憢 馃
Pydantic throws a ValidationError when converting a Decimal of an int to int. Not sure if this is the expected behavior.
Example Code
Python, Pydantic & OS Version
Selected Assignee: @lig
The text was updated successfully, but these errors were encountered: