Message394251
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.
Example:
>>> 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/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib/python3.8/_strptime.py", 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:58 | Fronkan | set | recipients:
+ Fronkan, jaraco, belopolsky, vstinner, ned.deily, ezio.melotti, flox, docs@python, python-dev, martin.panter, Elena.Oat, p-ganssle |
2021-05-24 14:15:58 | Fronkan | set | messageid: <1621865758.9.0.470225773771.issue13305@roundup.psfhosted.org> |
2021-05-24 14:15:58 | Fronkan | link | issue13305 messages |
2021-05-24 14:15:58 | Fronkan | create | |
|