mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-103822: [Calendar] change return value to enum for day and month APIs (GH-103827)
This commit is contained in:
parent
587f2f0180
commit
1f5384434d
2 changed files with 2 additions and 2 deletions
|
|
@ -83,7 +83,6 @@ class Day(IntEnum):
|
|||
SUNDAY = 6
|
||||
|
||||
|
||||
|
||||
# Number of days per month (except for February in leap years)
|
||||
mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
|
||||
|
||||
|
|
@ -156,7 +155,7 @@ def weekday(year, month, day):
|
|||
"""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()
|
||||
return Day(datetime.date(year, month, day).weekday())
|
||||
|
||||
|
||||
def monthrange(year, month):
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Update the return type of ``weekday`` to the newly added Day attribute
|
||||
Loading…
Add table
Add a link
Reference in a new issue