-
Notifications
You must be signed in to change notification settings - Fork 12.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
Make ".".parse::<f32>() and ".".parse::<f64>() return Err #30681
Conversation
Valid(Decimal::new(integral, b"", 0)) | ||
} | ||
None if integral.is_empty() => Invalid, // No digits at all | ||
None => Valid(Decimal::new(integral, b"", 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hastily added this branch in #29050 but I now believe it would be better to check for empty input at the start of the function. Since you're touching this condition anyway, I'd like you to move it there.
LGTM modulo nit, thanks! |
Is there a test somewhere that makes sure |
Ok, great! |
@rkruppe nit addressed, I believe |
Yes that's what I had in mind. Unfortunatly I habe not noticed another thing so I have to ask you to rebase again: The commit message and PR description should explicitly mention float parsing, to be absolutely clear without further context (i.e., when reading bitrust). |
This makes both of the following return Err: ".".parse::<f32>() ".".parse::<f64>() This is a [breaking-change], which the libs team have classified as a bug fix.
How's that @rkruppe? |
Neat 👍 As far as I am concerned, this PR can be merged, though I can understand if whoever gives the r+ wants to take a closer look for themselves. Edit: Apparently the fix for barosl/homu#65 still hasn't reached @bors 😢 Well, at least the commit message will be preserved. |
@bors r+ I took the chance to edit the PR message to include the title on the first line. It's what I usually do (until bors is fixed). Let's go, thanks for the reviewing @rkruppe, it looks correct and I'll rely mostly on you since you know this code so well. relnote related: Note that this changes how a corner case is parsed as float |
📌 Commit 33f3c52 has been approved by |
Make `".".parse::<f32>()` and `".".parse::<f64>()` return Err This fixes #30344. This is a [breaking-change], which the libs team have classified as a bug fix.
Make
".".parse::<f32>()
and".".parse::<f64>()
return ErrThis fixes #30344.
This is a [breaking-change], which the libs team have classified as a
bug fix.