Union types don't recognize bools in coercion order if ints or floats are included #2701
Closed
3 tasks done
Labels
bug V1
Bug related to Pydantic V1.X
Checks
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:This is kinda related to #2135, but a different enough case that it probably warrants its own issue.
In that bug, it was said "pydantic tries to coerce in the order of the union". The docs say something similar: "pydantic will attempt to 'match' any of the types defined under Union and will use the first one that matches."
That behavior appears to not work for bools -- bools seem to be cooerced to ints or floats if int or float is defined in the list:
The text was updated successfully, but these errors were encountered: