Skip to content

gh-153158: Remove the erroneous width argument of HTMLCalendar.formatmonthpage#153159

Open
tonghuaroot wants to merge 2 commits into
python:mainfrom
tonghuaroot:calendar-formatmonthpage-width
Open

gh-153158: Remove the erroneous width argument of HTMLCalendar.formatmonthpage#153159
tonghuaroot wants to merge 2 commits into
python:mainfrom
tonghuaroot:calendar-formatmonthpage-width

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

HTMLCalendar.formatmonthpage was added in 3.15 with a width argument copied from formatyearpage. A single month has no width to lay out, and HTMLCalendar.formatmonth's third positional is withyear, so width was silently forwarded as withyear. A falsy value dropped the year from the month heading:

>>> import calendar
>>> b'June 2009' in calendar.HTMLCalendar().formatmonthpage(2009, 6, 0)
False   # withyear=0, year dropped

This removes the parameter. The default output is unchanged. formatmonthpage is new in 3.15, which has not shipped a final release (latest tag v3.15.0b3), so removing it rather than deprecating it is safe; this should be backported to 3.15 only.

Note: dropping the parameter also means formatmonthpage(y, m, 3) now passes 3 to css rather than the (bogus) width. formatmonthpage is currently undocumented in Doc/library/calendar.rst; adding a doc entry is a separate follow-up.

I have left the backport label for a maintainer to assign.

…formatmonthpage

The argument is a meaningless copy-paste from formatyearpage; a single month has no width. formatmonthpage is new in 3.15 (currently unreleased at 3.15.0b3), so remove it rather than keep a broken argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant