-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
coerce_numbers_to_str
can cause unicode decode errors
#10664
Comments
coerce_numbers_to_str
causes unicode decode errorscoerce_numbers_to_str
can cause unicode decode errors
Looks like a bug, though not high priority. PRs welcome with a fix! The fix here will likely be in |
Hi there |
The error was because when
My PR will fix if only But if something else is used: min/max length, to_lower, to_upper, strip_whitespace or pattern then we will see the same error, but I hope it is expected |
pydantic 2.10 released |
Initial Checks
Description
Hi! I just upgraded pydantic version and was testing passing a string like
'hi there!\ud835'
which contains an unpaired unicode character to a model withcoerce_numbers_to_str=True
and saw a unicode error. When I changed it toFalse
it went away.I'm not sure whether this should/shouldn't throw an error, but I think the behavior should be more consistent.
Example Code
Python, Pydantic & OS Version
The text was updated successfully, but these errors were encountered: