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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes from2 commits
c20c6da
decd90f
81276eb
0a3e67b
5d1d53d
a0b0f07
d0e6a1f
2f6d8e2
ccabadf
35bc090
0637c29
71d7c8a
212c763
0201347
bebb241
40d2368
77c936a
e652581
0115ee4
25a6705
3bca8e9
ddd1d01
0139e57
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -14,6 +14,7 @@ | ||
import time | ||
import locale | ||
import calendar | ||
from re import A as re_A | ||
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
from re import compile as re_compile | ||
from re import sub as re_sub | ||
from re import IGNORECASE | ||
@@ -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 | re_A) | ||
_cache_lock = _thread_allocate_lock() | ||
# DO NOT modify _TimeRE_cache or _regex_cache without acquiring the cache lock | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page.
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
def test_strptime_single_digit(self): | ||
# bpo-34903: Check that single digit dates and times are allowed. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
:func:`datetime.datetime.strptime` now only accepts ASCII input. | ||
StanFromIreland marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. |
Uh oh!
There was an error while loading.Please reload this page.