]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962)
authorMichał Górny <mgorny@gentoo.org>
Tue, 11 Mar 2025 09:15:40 +0000 (10:15 +0100)
committerGitHub <noreply@github.com>
Tue, 11 Mar 2025 09:15:40 +0000 (10:15 +0100)
commit33494b4d0dafc34ff4f1c118b7b3b5d8de3dd0f4
treece3ae6ae73b7ca7ef90e2650fac1eafe0abe2b04
parent69309a55bcb5381a9a218edc910da135f4d67479
gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962)

* gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()`

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`).

* Add the news entry

* Use a different example to fix Sphinx lint

* Apply suggestions from code review

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
* Try fixing `:func:` ref.

---------

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
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]