Skip to content

Commit bc19cf5

Browse files
miss-islingtonxdegaye
authored andcommitted
bpo-32139: test_strftime does not anymore modify the locale (GH-4569) (#4636)
(cherry picked from commit cc55e78)
1 parent fc73c54 commit bc19cf5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/test/test_strftime.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def setUp(self):
6060
import java
6161
java.util.Locale.setDefault(java.util.Locale.US)
6262
except ImportError:
63-
import locale
64-
locale.setlocale(locale.LC_TIME, 'C')
63+
from locale import setlocale, LC_TIME
64+
saved_locale = setlocale(LC_TIME)
65+
setlocale(LC_TIME, 'C')
66+
self.addCleanup(setlocale, LC_TIME, saved_locale)
6567

6668
def test_strftime(self):
6769
now = time.time()

0 commit comments

Comments
 (0)