New submission from Serhiy Storchaka: strptime() can produce invalid time with negative year day when parse year-week-weekday set. Such time is rejected by strftime(), so strptime/strftime roundtrip doesn't work.
>>> t = time.strptime('2015 0 0', '%Y %U %w') >>> t time.struct_time(tm_year=2014, tm_mon=12, tm_mday=28, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=6, tm_yday=-3, tm_isdst=-1) >>> time.strftime('%Y %U %w', t) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: day of year out of range ---------- components: Library (Lib) messages: 238648 nosy: belopolsky, lemburg, serhiy.storchaka priority: normal severity: normal status: open title: strptime() can produce invalid date with negative year day type: behavior versions: Python 2.7, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23718> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com