Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r62532:1df60071a1fe
Date: 2013-03-19 17:52 -0700
http://bitbucket.org/pypy/pypy/changeset/1df60071a1fe/

Log:    initialize the locale before fsdecoding

diff --git a/pypy/goal/targetpypystandalone.py 
b/pypy/goal/targetpypystandalone.py
--- a/pypy/goal/targetpypystandalone.py
+++ b/pypy/goal/targetpypystandalone.py
@@ -10,6 +10,10 @@
 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:
@@ -49,9 +53,14 @@
         try:
             try:
                 space.call_function(w_run_toplevel, w_call_startup_gateway)
+                if not _WIN32:
+                    oldlocale = setlocale(LC_ALL, None)
+                    setlocale(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