mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
#10092: Properly reset locale in Locale*Calendar classes. The context manager was buggy because setlocale() returns the *new* locale, not the old. Also add a test for this.
This commit is contained in:
parent
f87cc04481
commit
7004bd1a3d
4 changed files with 30 additions and 5 deletions
|
|
@ -486,8 +486,8 @@ class different_locale:
|
|||
self.locale = locale
|
||||
|
||||
def __enter__(self):
|
||||
self.oldlocale = _locale.setlocale(_locale.LC_TIME, self.locale)
|
||||
#return _locale.getlocale(_locale.LC_TIME)[1]
|
||||
self.oldlocale = _locale.getlocale(_locale.LC_TIME)
|
||||
_locale.setlocale(_locale.LC_TIME, self.locale)
|
||||
|
||||
def __exit__(self, *args):
|
||||
_locale.setlocale(_locale.LC_TIME, self.oldlocale)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue