[Python-checkins] python/dist/src/Lib _strptime.py,1.15,1.16
bcannon@users.sourceforge.net
bcannon@users.sourceforge.net
Mon, 28 Apr 2003 14:30:16 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv22886/Lib
Modified Files:
_strptime.py
Log Message:
Raise a ValueError when there is data that was not covered in the format string. Done to match behavior of pre-existing C-based strptime implementations.
Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** _strptime.py 24 Apr 2003 16:02:41 -0000 1.15
--- _strptime.py 28 Apr 2003 21:30:11 -0000 1.16
***************
*** 424,427 ****
--- 424,430 ----
if not found:
raise ValueError("time data did not match format")
+ if len(data_string) != found.end():
+ raise ValueError("unconverted data remains: %s" %
+ data_string[found.end():])
year = 1900
month = day = 1