summaryrefslogtreecommitdiffstats
path: root/Lib/calendar.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2022-02-07 23:24:09 (GMT)
committerGitHub <noreply@github.com>2022-02-07 23:24:09 (GMT)
commit7a0486eaa98083e0407ff491872db6d7a0da2635 (patch)
tree6c8a06ae69a8caac5e4a2717f4f083f97a798dd5 /Lib/calendar.py
parent7ba1cc8049fbcb94ac039ab02522f78177130588 (diff)
downloadcpython-7a0486eaa98083e0407ff491872db6d7a0da2635.zip
cpython-7a0486eaa98083e0407ff491872db6d7a0da2635.tar.gz
cpython-7a0486eaa98083e0407ff491872db6d7a0da2635.tar.bz2
bpo-46659: calendar uses locale.getlocale() (GH-31166)
The calendar.LocaleTextCalendar and calendar.LocaleHTMLCalendar classes module now use locale.getlocale(), instead of using locale.getdefaultlocale(), if no locale is specified.
Diffstat (limited to 'Lib/calendar.py')
-rw-r--r--Lib/calendar.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 06c65a8..361898d 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -566,7 +566,7 @@ class LocaleTextCalendar(TextCalendar):
def __init__(self, firstweekday=0, locale=None):
TextCalendar.__init__(self, firstweekday)
if locale is None:
- locale = _locale.getdefaultlocale()
+ locale = _locale.getlocale(_locale.LC_TIME)
self.locale = locale
def formatweekday(self, day, width):
@@ -586,7 +586,7 @@ class LocaleHTMLCalendar(HTMLCalendar):
def __init__(self, firstweekday=0, locale=None):
HTMLCalendar.__init__(self, firstweekday)
if locale is None:
- locale = _locale.getdefaultlocale()
+ locale = _locale.getlocale(_locale.LC_TIME)
self.locale = locale
def formatweekday(self, day):