gh-158500: Reject trailing characters in date.fromisoformat - #158557
Draft
rupayon123 wants to merge 2 commits into
Draft
rupayon123 wants to merge 2 commits into
rupayon123 wants to merge 2 commits into
Conversation
|
The following commit authors need to sign the Contributor License Agreement: |
Member
|
Please sign the CLA. |
StanFromIreland
marked this pull request as draft
October 1, 2026 13:10
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #158500.
date.fromisoformat()currently accepts basic-format date and ISO-week strings with extra trailing characters because both parsers stop after their expected fields without checking that the input was fully consumed. Require complete input consumption in the C and pure-Python implementations, and cover both forms in the shared regression tests.Validation:
./python.exe -m test test_datetime --match '*fromisoformat*'passed (122 tests)../python.exe -m test test_datetimepassed (1,166 tests, 33 skipped), exercising both pure-Python and accelerated datetime implementations.git diff --cached --checkand CPythonTools/patchcheck/patchcheck.pypassed.The debug build completed but this machine lacks OpenSSL and several unrelated optional modules; the datetime tests above passed. AI assistance was used to prepare this contribution; I reviewed the diff and remain responsible for it.