Message202536
time.strptime leaks an IndexError, as seen in the following traceback.
[root@clnstor /tank/libs/cpython]# ./python
Python 3.4.0a4+ (default:0aa2aedc6a21+, Nov 5 2013, 17:10:42)
[GCC 4.2.1 20070831 patched [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strptime('19', '%Y %')
Traceback (most recent call last):
File "/tank/libs/cpython/Lib/_strptime.py", line 320, in _strptime
format_regex = _TimeRE_cache.compile(format)
File "/tank/libs/cpython/Lib/_strptime.py", line 268, in compile
return re_compile(self.pattern(format), IGNORECASE)
File "/tank/libs/cpython/Lib/_strptime.py", line 262, in pattern
self[format[directive_index]])
IndexError: string index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tank/libs/cpython/Lib/_strptime.py", line 494, in _strptime_time
tt = _strptime(data_string, format)[0]
File "/tank/libs/cpython/Lib/_strptime.py", line 332, in _strptime
raise ValueError("stray %% in format '%s'" % format)
ValueError: stray % in format '%Y %'
>>>
The attached patch suppresses the exception. This issue is similar (and based on) the issue17572. |
|
Date |
User |
Action |
Args |
2013-11-10 17:03:45 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa, belopolsky |
2013-11-10 17:03:45 | Claudiu.Popa | set | messageid: <1384103025.17.0.0483523701082.issue19545@psf.upfronthosting.co.za> |
2013-11-10 17:03:45 | Claudiu.Popa | link | issue19545 messages |
2013-11-10 17:03:44 | Claudiu.Popa | create | |
|