Author Matthew.Earl
Recipients Arfrever, Martin.Morrison, Matthew.Earl, belopolsky, hynek, pconnell, pitrou, swalker, vstinner
Date 2013-10-24.10:02:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
datetime.datetime.strptime() without a year fails on Feb 29 with:

>>> datetime.datetime.strptime("Feb 29", "%b %d")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/auto/ensoft-sjc/thirdparty/lib/python3.3/", line 511, in _strptime_datetime
    return cls(*args)
ValueError: day is out of range for month

This is because without a year specified the year is assumed to be 1900, which is not a leap year. The underlying _strptime._strptime() function has some munging such that it doesn't itself fail (see #14157):

>>> _strptime._strptime("Feb 29", "%b %d")
((1900, 2, 29, 0, 0, 0, 0, 60, -1, None, None), 0)

...however datetime.datetime.__init__() is called with this tuple as *args, causing the validation failure.
Date User Action Args
2013-10-24 10:02:17Matthew.Earlsetrecipients: + Matthew.Earl, belopolsky, pitrou, vstinner, Arfrever, swalker, hynek, Martin.Morrison, pconnell
2013-10-24 10:02:17Matthew.Earlsetmessageid: <>
2013-10-24 10:02:17Matthew.Earllinkissue19376 messages
2013-10-24 10:02:17Matthew.Earlcreate