[Python-checkins] cpython (3.4): #22751: fix test___all__ warning about modified environment in the tests.

ezio.melotti python-checkins at python.org
Sun Nov 2 18:15:43 CET 2014


https://hg.python.org/cpython/rev/37ed6eed0595
changeset:   93348:37ed6eed0595
branch:      3.4
parent:      93346:b5e9bc4352e1
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Sun Nov 02 19:08:35 2014 +0200
summary:
  #22751: fix test___all__ warning about modified environment in the tests.  Patch by Michael Cetrulo.

files:
  Lib/test/test___all__.py |  7 ++++---
  Misc/ACKS                |  1 +
  2 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test___all__.py b/Lib/test/test___all__.py
--- a/Lib/test/test___all__.py
+++ b/Lib/test/test___all__.py
@@ -72,13 +72,14 @@
 
         # rlcompleter needs special consideration; it import readline which
         # initializes GNU readline which calls setlocale(LC_CTYPE, "")... :-(
+        import locale
+        locale_tuple = locale.getlocale(locale.LC_CTYPE)
         try:
             import rlcompleter
-            import locale
         except ImportError:
             pass
-        else:
-            locale.setlocale(locale.LC_CTYPE, 'C')
+        finally:
+            locale.setlocale(locale.LC_CTYPE, locale_tuple)
 
         ignored = []
         failed_imports = []
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -222,6 +222,7 @@
 Matej Cepl
 Carl Cerecke
 Octavian Cerna
+Michael Cetrulo
 Dave Chambers
 Pascal Chambon
 John Chandler

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list