New submission from Claudiu.Popa: 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. ---------- components: Library (Lib) files: time_strptime.patch keywords: patch messages: 202536 nosy: Claudiu.Popa, belopolsky priority: normal severity: normal status: open title: time.strptime exception context versions: Python 3.4 Added file: http://bugs.python.org/file32563/time_strptime.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19545> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com