Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Open
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
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
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status