Bug report
Bug description:
>>>fromdatetimeimportdatetime>>>datetime.strptime(datetime(1000, 1, 1).strftime("%c"), "%c")
datetime.datetime(1000, 1, 1, 0, 0)
>>>datetime.strptime(datetime(999, 1, 1).strftime("%c"), "%c")
Traceback (mostrecentcalllast):
File"<python-input-1>", line1, in<module>datetime.strptime(datetime(999, 1, 1).strftime("%c"), "%c")
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/home/nlx5/Documents/Programming/Python/cpython/Lib/_strptime.py", line573, in_strptime_datetimett, fraction, gmtoff_fraction=_strptime(data_string, format)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^File"/home/nlx5/Documents/Programming/Python/cpython/Lib/_strptime.py", line352, in_strptimeraiseValueError("time data %r does not match format %r"%
(data_string, format))
ValueError: timedata'Tue Jan 1 00:00:00 999'doesnotmatchformat'%c'Discovered this when adding some hypothesis tests for strptime/strftime. I doubt this is a real problem anyone is going to have in the real world, but maybe.
I do not know if this is locale-specific or OS specific.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug report
Bug description:
Discovered this when adding some hypothesis tests for
strptime/strftime. I doubt this is a real problem anyone is going to have in the real world, but maybe.I do not know if this is locale-specific or OS specific.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
_strptimeto make%c/%xaccept a year with fewer digits #124778