Skip to content

[3.12] gh-130959: Reject whitespace in fractions, in pure Python fromisoformat() (GH-130962) (GH-131076) - #131086

Merged
vstinner merged 1 commit into
python:3.12from
miss-islington:backport-27fd328-3.12
Mar 11, 2025
Merged

vstinner merged 1 commit into
python:3.12from
miss-islington:backport-27fd328-3.12

Conversation

@miss-islington

Copy link
Copy Markdown
Contributor

gh-130959: Reject whitespace in fractions, in pure Python fromisoformat() (GH-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 [email protected]
Co-authored-by: Paul Ganssle [email protected]
(cherry picked from commit 33494b4)
(cherry picked from commit 27fd328)

Co-authored-by: Victor Stinner [email protected]
Co-authored-by: Michał Górny [email protected]

…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 <[email protected]>
Co-authored-by: Paul Ganssle <[email protected]>
(cherry picked from commit 33494b4)
(cherry picked from commit 27fd328)

Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Michał Górny <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants