Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r63624:4077749cb58a
Date: 2013-04-25 19:19 -0700
http://bitbucket.org/pypy/pypy/changeset/4077749cb58a/

Log:    simply set the default locale here at startup, so nl_langinfo can be
        used correctly early on

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -7,13 +7,10 @@
 from pypy.tool.ann_override import PyPyAnnotatorPolicy
 from rpython.config.config import to_optparse, make_dict, SUPPRESS_USAGE
 from rpython.config.config import ConflictConfigError
+from rpython.rlib import rlocale
 from pypy.tool.option import make_objspace
 from pypy.conftest import pypydir
 
-_WIN32 = sys.platform == 'win32'
-if not _WIN32:
-    from rpython.rlib.rlocale import LC_ALL, setlocale
-
 thisdir = py.path.local(__file__).dirpath()
 
 try:
@@ -53,14 +50,11 @@
         try:
             try:
                 space.call_function(w_run_toplevel, w_call_startup_gateway)
-                if not _WIN32:
-                    oldlocale = setlocale(LC_ALL, None)
-                    setlocale(LC_ALL, '')
+                if rlocale.HAVE_LANGINFO:
+                    rlocale.setlocale(rlocale.LC_ALL, '')
                 w_executable = space.fsdecode(space.wrapbytes(argv[0]))
                 w_argv = space.newlist([space.fsdecode(space.wrapbytes(s))
                                         for s in argv[1:]])
-                if not _WIN32:
-                    setlocale(LC_ALL, oldlocale)
                 w_exitcode = space.call_function(w_entry_point, w_executable, 
w_argv)
                 exitcode = space.int_w(w_exitcode)
                 # try to pull it all in
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to