[Python-checkins] r72381 - in python/branches/release26-maint: Lib/locale.py

jeroen.ruigrok python-checkins at python.org
Wed May 6 09:41:27 CEST 2009


Author: jeroen.ruigrok
Date: Wed May 6 09:41:26 2009
New Revision: 72381
Log:
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
........
Modified:
 python/branches/release26-maint/ (props changed)
 python/branches/release26-maint/Lib/locale.py
Modified: python/branches/release26-maint/Lib/locale.py
==============================================================================
--- python/branches/release26-maint/Lib/locale.py	(original)
+++ python/branches/release26-maint/Lib/locale.py	Wed May 6 09:41:26 2009
@@ -546,7 +546,10 @@
 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


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /