Serhiy Storchaka added the comment: In C the strptime function doesn't return valid data if an input is invalid.
$ ./strptimetest "0 2015 1" "%W %Y %w" 2015-00--2 00:00:00 $ ./strptimetest "0 2015 2" "%W %Y %w" 2015-00--1 00:00:00 $ ./strptimetest "0 2015 3" "%W %Y %w" 2015-00-00 00:00:00 $ ./strptimetest "0 2015 4" "%W %Y %w" 2015-01-01 00:00:00 $ ./strptimetest "0 2015 5" "%W %Y %w" 2015-01-02 00:00:00 $ ./strptimetest "0 2015 6" "%W %Y %w" 2015-01-03 00:00:00 $ ./strptimetest "0 2015 7" "%W %Y %w" 2015-01-00 00:00:00 So this behavior likely is not a bug and doesn't need to be fixed in maintained releases. But it would be good to make strptime() more consistant and either extend it to support week and weekday numbers out of current valid range, or raise an exception. ---------- nosy: +belopolsky, serhiy.storchaka versions: +Python 3.5 Added file: http://bugs.python.org/file37566/strptimetest.c _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23134> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com