tonghuaroot · GitHub

HTMLCalendar.formatmonthpage, added in 3.15, takes a width argument:

def formatmonthpage(self, theyear, themonth, width=3, css='calendar.css', encoding=None):
    ...
    v.append(self.formatmonth(theyear, themonth, width))

The signature was copied from formatyearpage, but a single month has no width to lay out. HTMLCalendar.formatmonth(theyear, themonth, withyear=True) takes withyear as its third positional, so width is forwarded as withyear. A falsy value silently drops the year from the month heading:

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

The argument is meaningless and should be removed. formatmonthpage is new in 3.15, which has not shipped a final release yet (latest tag v3.15.0b3), so removing the parameter rather than deprecating it is safe.

Linked PRs

Read the original on github.com ↗