prevent trailing dots in integers #1267
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Summary
I noticed while writing the description for #1266 that the docstring for
strip_decimal_zeros
(now part ofclean_int_str
) didn't match the actual behaviour:pydantic-core/src/input/shared.rs
Lines 120 to 129 in e23d7eb
Specifically the comment said (which makes sense) that we were stripping
.0+
- e.g. dot and one or more zeros. But we were actually stripping dot and zero or more zeros, e.g..
, e.g.'42.'
was a valid integer.This seems clearly incorrect.
NOTE: technically this is a breaking change albeit very small. I think it's okay, but happy to discuss.
cc @adriangb @sydney-runkle @davidhewitt