FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-130959: Reject whitespace in fractions, in pure Python `fromisoformat()` (#130962) by vstinner · Pull Request #131076 · python/cpython · GitHub

Repository navigation

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

Merged
vstinner merged 1 commit into
python:3.13from
vstinner:fromisoformat13
Mar 11, 2025
Merged

vstinner merged 1 commit into
python:3.13from
vstinner:fromisoformat13

Conversation

vstinner commented Mar 11, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

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)

…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)

Copy link
Copy Markdown
Member Author

@mgorny: Would you mind to double check this backport to 3.13? I had to fix merge conflicts.

mgorny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Don't see anything obviously wrong, and the tests passed. Thanks!

vstinner merged commit 27fd328 into python:3.13 Mar 11, 2025
vstinner deleted the fromisoformat13 branch March 11, 2025 11:39

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

bedevere-app Bot commented Mar 11, 2025

Copy link
Copy Markdown

GH-131086 is a backport of this pull request to the 3.12 branch.

bedevere-app Bot removed the needs backport to 3.12 only security fixes label Mar 11, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 11, 2025
…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>
vstinner added a commit that referenced this pull request Mar 11, 2025
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL