Author Fronkan
Recipients Elena.Oat, Fronkan, belopolsky, docs@python, ezio.melotti, flox, jaraco, martin.panter, ned.deily, p-ganssle, python-dev, vstinner
Date 2021-05-24.14:15:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This also causes an issue when using stftime and strptime together on Linux (Ubuntu 20.04.1 LTS).
When encoding a datetime using strftime and decoding with strptime using the same pattern an error is raised if year < 1000.

>>> pattern = "%Y-%m-%d"
>>> datetime.strptime(
...     datetime(1, 1, 1).strftime(pattern),
...     pattern
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.8/", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '1-01-01' does not match format '%Y-%m-%d'
Date User Action Args
2021-05-24 14:15:58Fronkansetrecipients: + Fronkan, jaraco, belopolsky, vstinner, ned.deily, ezio.melotti, flox, docs@python, python-dev, martin.panter, Elena.Oat, p-ganssle
2021-05-24 14:15:58Fronkansetmessageid: <>
2021-05-24 14:15:58Fronkanlinkissue13305 messages
2021-05-24 14:15:58Fronkancreate