Fredrik Bengtsson <fredrik.bengtsso...@gmail.com> added the comment:
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' ---------- nosy: +Fronkan _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue13305> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com