Christian Heimes added the comment:
I like to move _PyExc_Init() before _PySys_Init() and set sys.prefix,
exec_prefix and executable with PyUnicode_DecodeFSDefault().
Without the changes Python is seg faulting on Windows when the path
contains non ASCII chars. With the patch it is failing with a fatal
error which is a tiny bit nicer.
Added file: http://bugs.python.org/file8741/py3k_win_nonascii.patch
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1342>
__________________________________
Index: Python/pythonrun.c
===================================================================
--- Python/pythonrun.c (revision 58959)
+++ Python/pythonrun.c (working copy)
@@ -217,6 +217,9 @@
Py_FatalError("Py_Initialize: can't initialize builtins dict");
Py_INCREF(interp->builtins);
+ /* initialize builtin exceptions */
+ _PyExc_Init();
+
sysmod = _PySys_Init();
if (sysmod == NULL)
Py_FatalError("Py_Initialize: can't initialize sys");
@@ -239,9 +242,6 @@
_PyImport_Init();
- /* initialize builtin exceptions */
- _PyExc_Init();
-
/* phase 2 of builtins */
_PyImport_FixupExtension("__builtin__", "__builtin__");
Index: Python/sysmodule.c
===================================================================
--- Python/sysmodule.c (revision 58958)
+++ Python/sysmodule.c (working copy)
@@ -1072,11 +1072,12 @@
SET_SYS_FROM_STRING("platform",
PyUnicode_FromString(Py_GetPlatform()));
SET_SYS_FROM_STRING("executable",
- PyUnicode_FromString(Py_GetProgramFullPath()));
+ PyUnicode_DecodeFSDefault(
+ Py_GetProgramFullPath()));
SET_SYS_FROM_STRING("prefix",
- PyUnicode_FromString(Py_GetPrefix()));
+ PyUnicode_DecodeFSDefault(Py_GetPrefix()));
SET_SYS_FROM_STRING("exec_prefix",
- PyUnicode_FromString(Py_GetExecPrefix()));
+ PyUnicode_DecodeFSDefault(Py_GetExecPrefix()));
SET_SYS_FROM_STRING("maxint",
PyInt_FromLong(PyInt_GetMax()));
SET_SYS_FROM_STRING("maxsize",
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com