diff -r c310233b1d64 Lib/_strptime.py --- a/Lib/_strptime.py Sat Apr 21 15:52:11 2012 +0100 +++ b/Lib/_strptime.py Sat Apr 21 19:08:45 2012 +0200 @@ -339,7 +339,7 @@ raise ValueError("unconverted data remains: %s" % data_string[found.end():]) - year = 1900 + year = None month = day = 1 hour = minute = second = fraction = 0 tz = -1 @@ -444,6 +444,10 @@ else: tz = value break + if year is None and month == 2 and day == 29: + year = 1904 # 1904 is first leap year of 20th century + elif year is None: + year = 1900 # If we know the week of the year and what day of that week, we can figure # out the Julian day of the year. if julian == -1 and week_of_year != -1 and weekday != -1: diff -r c310233b1d64 Lib/test/test_strptime.py --- a/Lib/test/test_strptime.py Sat Apr 21 15:52:11 2012 +0100 +++ b/Lib/test/test_strptime.py Sat Apr 21 19:08:45 2012 +0200 @@ -378,6 +378,9 @@ need_escaping = ".^$*+?{}\[]|)(" self.assertTrue(_strptime._strptime_time(need_escaping, need_escaping)) + def test_feb29_on_leap_year_without_year(self): + time.strptime("Feb 29", "%b %d") + class Strptime12AMPMTests(unittest.TestCase): """Test a _strptime regression in '%I %p' at 12 noon (12 PM)"""