Closed thomasjpfan closed 6 months ago
Currently, yeah. I could see adding support for coercing floats without a decimal component to integers though if needed (so 3.0 would be valid, but 3.5 would error). Can you say more about your use case here?
I'm ingesting in a format that deserializes all numerical values to floats, while the original type was an int. Since the original data were ints the floats end up being: 1.0, 6.0, etc
.
At a high level, the data serialization is:
msgspec
to convert json back into a Python typeI sense there is a bug in 3, so I likely do not require msgspec
casting floats into ints.
I've added support for this in #619. Even though you said this likely wasn't necessary, it felt like something we could/should support (and supporting it was easy to do). Thanks for raising the issue!
Description
On
msgspec==0.18.4
,strict=False
does not cast floats to ints:Is this expected behavior with
strict=False
?