Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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:main
base:main
Choose a base branch
Loading
fromStanFromIreland:ascii-strptime
Open
Show file tree
Hide file tree
Changes from2 commits
Commits
Show all changes
23 commits
Select commitHold shift + click to select a range
c20c6da
Initial
StanFromIrelandMar 9, 2025
decd90f
Fix NEWS
StanFromIrelandMar 9, 2025
81276eb
sggestion
StanFromIrelandMar 9, 2025
0a3e67b
Alphabetical order…
StanFromIrelandMar 9, 2025
5d1d53d
Benedikts suggestions
StanFromIrelandMar 9, 2025
a0b0f07
Add docs and tests for time.strptime
StanFromIrelandMar 9, 2025
d0e6a1f
Cover the majority
StanFromIrelandMar 10, 2025
2f6d8e2
Cover all
StanFromIrelandMar 10, 2025
ccabadf
Clean up
StanFromIrelandMar 10, 2025
35bc090
Benedikt's Doc suggestions
StanFromIrelandMar 12, 2025
0637c29
Apply suggestions from code review
StanFromIrelandMar 15, 2025
71d7c8a
Re-word news
StanFromIrelandMar 15, 2025
212c763
Apply suggestions from code review
StanFromIrelandMar 15, 2025
0201347
PEP 8
StanFromIrelandMar 15, 2025
bebb241
REQUESTED CHANGES
StanFromIrelandMar 23, 2025
40d2368
Refactor documentation changes
pganssleMar 26, 2025
77c936a
Clarify non-ASCII parsing in news
pganssleMar 26, 2025
e652581
fixup! Refactor documentation changes
pganssleMar 26, 2025
0115ee4
Unrequire ascii
StanFromIrelandMar 26, 2025
25a6705
Merge branch 'main' into ascii-strptime
StanFromIrelandApr 24, 2025
3bca8e9
Merge branch 'main' into ascii-strptime
pganssleMay 19, 2025
ddd1d01
Adjust documentation to be specific about where non-ASCII digits are …
pganssleMay 19, 2025
0139e57
Move whatsnew
StanFromIrelandMay 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletionLib/_strptime.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,7 @@
import time
import locale
import calendar
from re import A as re_A
from re import compile as re_compile
from re import sub as re_sub
from re import IGNORECASE
Expand DownExpand Up@@ -380,7 +381,7 @@ def repl(m):

def compile(self, format):
"""Return a compiled re object for the format string."""
return re_compile(self.pattern(format), IGNORECASE)
return re_compile(self.pattern(format), IGNORECASE | re_A)

_cache_lock = _thread_allocate_lock()
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock
Expand Down
3 changes: 3 additions & 0 deletionsLib/test/datetimetester.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2916,6 +2916,9 @@ def test_strptime(self):
with self.assertRaises(ValueError): strptime("-000", "%z")
with self.assertRaises(ValueError): strptime("z", "%z")

# test only ascii is allowed
with self.assertRaises(ValueError): strptime('٢025-03-09', '%Y-%m-%d')

def test_strptime_single_digit(self):
# bpo-34903: Check that single digit dates and times are allowed.

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
:func:`datetime.datetime.strptime` now only accepts ASCII input.
Loading

[8]ページ先頭

©2009-2025 Movatter.jp