-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
[3.13] gh-130959: Reject whitespace in fractions, in pure Python fromisoformat()
(#130962)
#131076
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
Conversation
…isoformat()` (python#130962) Fix the pure Python implementation of `fromisoformat()` to reject any non-digit characters, including whitespace, in the fractional part of time specification. This makes the behavior consistent with the C implementation, and prevents incorrect parsing of these fractions (e.g. `.400 ` would be misinterpreted as `.04`). Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com> (cherry picked from commit 33494b4)
@mgorny: Would you mind to double check this backport to 3.13? I had to fix merge conflicts. |
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.
Don't see anything obviously wrong, and the tests passed. Thanks!
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
GH-131086 is a backport of this pull request to the 3.12 branch. |
…n `fromisoformat()` (pythonGH-130962) (pythonGH-131076) pythongh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (pythonGH-130962) Fix the pure Python implementation of `fromisoformat()` to reject any non-digit characters, including whitespace, in the fractional part of time specification. This makes the behavior consistent with the C implementation, and prevents incorrect parsing of these fractions (e.g. `.400 ` would be misinterpreted as `.04`). Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com> (cherry picked from commit 33494b4) (cherry picked from commit 27fd328) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Michał Górny <mgorny@gentoo.org>
…mat()` (GH-130962) (GH-131076) (#131086) Fix the pure Python implementation of `fromisoformat()` to reject any non-digit characters, including whitespace, in the fractional part of time specification. This makes the behavior consistent with the C implementation, and prevents incorrect parsing of these fractions (e.g. `.400 ` would be misinterpreted as `.04`). (cherry picked from commit 33494b4) (cherry picked from commit 27fd328) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Michał Górny <mgorny@gentoo.org>
Fix the pure Python implementation of
fromisoformat()
to reject any non-digit characters, including whitespace, in the fractional part of time specification. This makes the behavior consistent with the C implementation, and prevents incorrect parsing of these fractions (e.g..400
would be misinterpreted as.04
).Co-authored-by: Peter Bierma zintensitydev@gmail.com
Co-authored-by: Paul Ganssle 1377457+pganssle@users.noreply.github.com
(cherry picked from commit 33494b4)
fromisoformat()
handles times with trailing spaces inconsistently with the C extension #130959