You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a directive that is not recognised by time.strptime, the following occurs in Python 3:
>>> time.strptime("", "%D")
Traceback (most recent call last):
File "C:\Python33\lib\_strptime.py", line 320, in _strptime
format_regex = _TimeRE_cache.compile(format)
File "C:\Python33\lib\_strptime.py", line 268, in compile
return re_compile(self.pattern(format), IGNORECASE)
File "C:\Python33\lib\_strptime.py", line 262, in pattern
self[format[directive_index]])
KeyError: 'D'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python33\lib\_strptime.py", line 494, in _strptime_time
tt = _strptime(data_string, format)[0]
File "C:\Python33\lib\_strptime.py", line 329, in _strptime
(bad_directive, format))
ValueError: 'D' is a bad directive in format '%D'
>>>
Probably the KeyError should be supressed when raising the ValueError. The attached patch tries to fix this issue, by suppressing the context.
The fix LGTM. The attached patch tweaks a bit your test and adds another one to check _strptime directly.
python-dev commented on Apr 3, 2013
python-devmannequin
Mannequin
More actions
New changeset 3203e083aa7b by Ezio Melotti in branch '3.3': bpo-17572: Avoid chained exceptions while passing bad directives to time.strptime(). Initial patch by Claudiu Popa. http://hg.python.org/cpython/rev/3203e083aa7b
Activity
PCManticore commentedon Mar 29, 2013
When using a directive that is not recognised by time.strptime, the following occurs in Python 3:
Probably the KeyError should be supressed when raising the ValueError. The attached patch tries to fix this issue, by suppressing the context.
ezio-melotti commentedon Mar 29, 2013
The fix LGTM. The attached patch tweaks a bit your test and adds another one to check _strptime directly.
python-dev commentedon Apr 3, 2013
New changeset 3203e083aa7b by Ezio Melotti in branch '3.3':
bpo-17572: Avoid chained exceptions while passing bad directives to time.strptime(). Initial patch by Claudiu Popa.
http://hg.python.org/cpython/rev/3203e083aa7b
New changeset d408c9bd4bf7 by Ezio Melotti in branch 'default':
bpo-17572: merge with 3.3.
http://hg.python.org/cpython/rev/d408c9bd4bf7
ezio-melotti commentedon Apr 3, 2013
Fixed, thanks for the report and the patch!
gh-161763: Correct SSL docs for unconnected client sockets (#GH-61772)
[3.15] gh-161763: Correct SSL docs for unconnected client sockets (#G…
[3.14] gh-161763: Correct SSL docs for unconnected client sockets (#G…
pythongh-161763: Correct SSL docs for unconnected client sockets (#py…