]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 72376 via svnmerge from
authorJeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Wed, 6 May 2009 08:25:53 +0000 (08:25 +0000)
committerJeroen Ruigrok van der Werven <asmodai@in-nomine.org>
Wed, 6 May 2009 08:25:53 +0000 (08:25 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r72376 | jeroen.ruigrok | 2009-05-06 07:33:24 +0200 (wo, 06 mei 2009) | 12 lines

  Merged revisions 72375 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r72375 | jeroen.ruigrok | 2009-05-06 07:25:42 +0200 (wo, 06 mei 2009) | 5 lines

    Wrap getpreferredencoding()'s use of setlocale in a try/except to prevent
    us from raising an exception when the locale is invalid.

    Issue #1443504
  ........
................

Lib/locale.py

index 17056b9df216fc1076b040e9f2ab962021c50b00..7d06b06614b5ba7398a25777427a1599ef5b7fa0 100644 (file)
@@ -557,7 +557,10 @@ else:
             according to the system configuration."""
             if do_setlocale:
                 oldloc = setlocale(LC_CTYPE)
-                setlocale(LC_CTYPE, "")
+                try:
+                    setlocale(LC_CTYPE, "")
+                except:
+                    pass
                 result = nl_langinfo(CODESET)
                 setlocale(LC_CTYPE, oldloc)
                 return result