pydantic-core
pydantic-core copied to clipboard
stop bytes being converted to `int` and `float`
stop using maybe_as_string.
Just a quick question: So you want to make "coerce" mode a bit stricter right? And for pydantic v2 what is your plan?
- update the doc and say that people should add custom validator to coerce to string if they want?
- add it directly in pydantic v2 behind a flag/config param?
Maybe, I want to avoid config flags if possible but some might be necessary.
See what others say.
Humm, I'm not sure about this anymore.
There are two fairly intuitive representations of b'123' as an int:
b = b'123'
assert int(b) == 123
assert int.from_bytes(b, 'big') == 3224115
I can imagine the vast majority of users would expect the first option to work (as it does now).
Let's leave this for now.