New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ser_json_inf_nan
not respected when used with an Any list
#8693
Comments
matsjoyce-refeyn
added
bug V2
Bug related to Pydantic V2
pending
Awaiting a response / confirmation
labels
Feb 1, 2024
Thanks for reporting this. This looks pretty similar to #8440, and is definitely something that we want to fix. I'll add this to the 2.7.0 milestone and make sure we get a fix out for this with the next minor release 👍. Thanks for bringing this to our attention! |
1 task
This was referenced Mar 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial Checks
Description
When using a dataclass with a non-specialised list, NaNs are serialised in json mode as None, not NaN, even when
ser_json_inf_nan
is set to constants. This behaviour goes away iflist[float]
is used. But for my use case, the list might be arbitrarily nested (e.g.list[list[list[float]]]
) so leaving it aslist[Any]
seems to be the only solution (unless recursive type aliases are supported).Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: