diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-03-12 08:53:09 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-03-12 08:53:09 (GMT) |
commit | 6e4150f36b74622a23ea0fd259bd61bbd753d3fd (patch) | |
tree | 84db1e42e46f64a4339bd85c3500c7424effd112 /Lib/_strptime.py | |
parent | 15a83e845fa2421428f9d06c6fe6e85fde59d22c (diff) | |
parent | 8a7240eeed609f747bdf38985679816ed9f61a0e (diff) | |
download | cpython-6e4150f36b74622a23ea0fd259bd61bbd753d3fd.zip cpython-6e4150f36b74622a23ea0fd259bd61bbd753d3fd.tar.gz cpython-6e4150f36b74622a23ea0fd259bd61bbd753d3fd.tar.bz2 |
Issue #23718: Fixed parsing time in week 0 before Jan 1. Original patch by
Tamás Bence Gedai.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r-- | Lib/_strptime.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py index 8da4fcd..fe94361 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -514,6 +514,10 @@ def _strptime(data_string, format="%a %b %d %H:%M:%S %Y"): week_starts_Mon) elif iso_year is not None and iso_week is not None: year, julian = _calc_julian_from_V(iso_year, iso_week, weekday + 1) + if julian is not None and julian <= 0: + year -= 1 + yday = 366 if calendar.isleap(year) else 365 + julian += yday if julian is None: # Cannot pre-calculate datetime_date() since can change in Julian |