]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (GH-13096...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 11 Mar 2025 12:00:06 +0000 (13:00 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 12:00:06 +0000 (12:00 +0000)
commit8f26a79b3322d29ad603662c2b01109f2a719506
tree1b828d5fba897f0ae71fbda1e73202cab7e60bd5
parent3f226c5a7f776997b8bec4c7009b07c7bc93da94
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (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 33494b4d0dafc34ff4f1c118b7b3b5d8de3dd0f4)
(cherry picked from commit 27fd328cf68e5d812cdb7f9533a16dd68d911c54)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Michał Górny <mgorny@gentoo.org>
Lib/_pydatetime.py
Lib/test/datetimetester.py
Misc/NEWS.d/next/Library/2025-03-07-19-24-27.gh-issue-130959.xO8vVS.rst [new file with mode: 0644]