diff options
author | Alexander Belopolsky <abalkin@users.noreply.github.com> | 2017-10-26 15:34:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-26 15:34:11 -0400 |
commit | 66c88ce30ca2b23daa37038e1a3c0de98f241f50 (patch) | |
tree | 91e0dcb60059c3025fef3ea4e2dcb849f25b103f /Lib/calendar.py | |
parent | bpo-30553: Add status code 421 to http.HTTPStatus (GH-2589) (diff) | |
download | cpython-66c88ce30ca2b23daa37038e1a3c0de98f241f50.tar.gz cpython-66c88ce30ca2b23daa37038e1a3c0de98f241f50.tar.bz2 cpython-66c88ce30ca2b23daa37038e1a3c0de98f241f50.zip |
Closes bpo-28281: Remove year (1-9999) limits on the weekday() function. (#4109)
Patch by Mark Gollahon.
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r-- | Lib/calendar.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py index fb594e0f5b0..3828c43ed27 100644 --- a/Lib/calendar.py +++ b/Lib/calendar.py @@ -111,8 +111,9 @@ def leapdays(y1, y2): def weekday(year, month, day): - """Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12), - day (1-31).""" + """Return weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31).""" + if not datetime.MINYEAR <= year <= datetime.MAXYEAR: + year = 2000 + year % 400 return datetime.date(year, month, day).weekday() |