Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-83461: Don't allow datetime parsing to accept non-ASCII digits#131008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
StanFromIreland wants to merge23 commits intopython:mainChoose a base branch fromStanFromIreland:ascii-strptime
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+62 −16
Open
Changes fromall commits
Commits
Show all changes
23 commits Select commitHold shift + click to select a range
c20c6da
Initial
StanFromIrelanddecd90f
Fix NEWS
StanFromIreland81276eb
sggestion
StanFromIreland0a3e67b
Alphabetical order…
StanFromIreland5d1d53d
Benedikts suggestions
StanFromIrelanda0b0f07
Add docs and tests for time.strptime
StanFromIrelandd0e6a1f
Cover the majority
StanFromIreland2f6d8e2
Cover all
StanFromIrelandccabadf
Clean up
StanFromIreland35bc090
Benedikt's Doc suggestions
StanFromIreland0637c29
Apply suggestions from code review
StanFromIreland71d7c8a
Re-word news
StanFromIreland212c763
Apply suggestions from code review
StanFromIreland0201347
PEP 8
StanFromIrelandbebb241
REQUESTED CHANGES
StanFromIreland40d2368
Refactor documentation changes
pganssle77c936a
Clarify non-ASCII parsing in news
pgansslee652581
fixup! Refactor documentation changes
pganssle0115ee4
Unrequire ascii
StanFromIreland25a6705
Merge branch 'main' into ascii-strptime
StanFromIreland3bca8e9
Merge branch 'main' into ascii-strptime
pganssleddd1d01
Adjust documentation to be specific about where non-ASCII digits are …
pganssle0139e57
Move whatsnew
StanFromIrelandFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
1 change: 1 addition & 0 deletionsDoc/whatsnew/3.14.rst
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
18 changes: 18 additions & 0 deletionsDoc/whatsnew/3.15.rst
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -286,23 +286,23 @@ def __init__(self, locale_time=None): | ||
base = super() | ||
mapping = { | ||
# The " [1-9]" part of the regex is to make %c from ANSI C work | ||
'd': r"(?P<d>3[0-1]|[1-2][0-9]|0[1-9]|[1-9]| [1-9])", | ||
'f': r"(?P<f>[0-9]{1,6})", | ||
'H': r"(?P<H>2[0-3]|[0-1][0-9]|[0-9])", | ||
'I': r"(?P<I>1[0-2]|0[1-9]|[1-9]| [1-9])", | ||
'G': r"(?P<G>[0-9][0-9][0-9][0-9])", | ||
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
'j': r"(?P<j>36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|0[1-9][0-9]|00[1-9]|[1-9][0-9]|0[1-9]|[1-9])", | ||
'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])", | ||
'M': r"(?P<M>[0-5][0-9]|[0-9])", | ||
'S': r"(?P<S>6[0-1]|[0-5][0-9]|[0-9])", | ||
'U': r"(?P<U>5[0-3]|[0-4][0-9]|[0-9])", | ||
'w': r"(?P<w>[0-6])", | ||
'u': r"(?P<u>[1-7])", | ||
'V': r"(?P<V>5[0-3]|0[1-9]|[1-4][0-9]|[0-9])", | ||
# W is set below by using 'U' | ||
'y': r"(?P<y>[0-9][0-9])", | ||
'Y': r"(?P<Y>[0-9]{4})", | ||
'z': r"(?P<z>[+-][0-9][0-9]:?[0-5][0-9](:?[0-5][0-9](\.[0-9]{1,6})?)?|(?-i:Z))", | ||
'A': self.__seqToRE(self.locale_time.f_weekday, 'A'), | ||
'a': self.__seqToRE(self.locale_time.a_weekday, 'a'), | ||
'B': self.__seqToRE(self.locale_time.f_month[1:], 'B'), | ||
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
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
3 changes: 3 additions & 0 deletionsMisc/NEWS.d/next/Library/2025-03-09-11-01-00.gh-issue-83461.auwd13.rst
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Digits passed to :meth:`datetime.date.strptime`, :meth:`datetime.datetime.strptime`, | ||
:meth:`datetime.time.strptime` and :meth:`time.strptime` must now be ASCII in | ||
non-locale-specific numeric format codes. |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.