Skip to content

Commit 7ff51bd

Browse files
Issue python#28255: calendar.TextCalendar().prmonth() no longer prints a space
at the start of new line after printing a month's calendar. Patch by Xiang Zhang.
1 parent f3ebc9f commit 7ff51bd

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Lib/calendar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def prmonth(self, theyear, themonth, w=0, l=0):
312312
"""
313313
Print a month's calendar.
314314
"""
315-
print(self.formatmonth(theyear, themonth, w, l), end=' ')
315+
print(self.formatmonth(theyear, themonth, w, l), end='')
316316

317317
def formatmonth(self, theyear, themonth, w=0, l=0):
318318
"""

Lib/test/test_calendar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ def test_prweek(self):
409409
def test_prmonth(self):
410410
with support.captured_stdout() as out:
411411
calendar.TextCalendar().prmonth(2004, 1)
412-
output = out.getvalue().strip()
413-
self.assertEqual(output, result_2004_01_text.strip())
412+
self.assertEqual(out.getvalue(), result_2004_01_text)
414413

415414
def test_pryear(self):
416415
with support.captured_stdout() as out:

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ Core and Builtins
113113
Library
114114
-------
115115

116+
- Issue #28255: calendar.TextCalendar().prmonth() no longer prints a space
117+
at the start of new line after printing a month's calendar. Patch by
118+
Xiang Zhang.
119+
116120
- Issue #20491: The textwrap.TextWrapper class now honors non-breaking spaces.
117121
Based on patch by Kaarle Ritvanen.
118122

0 commit comments

Comments
 (0)