diff Modules/_tkinter.c @ 46318:22a74eaf6b22

Change command line processing API to use wchar_t. Fixes #2128.
author Martin v. Löwis <martin@v.loewis.de>
date Sat, 05 Apr 2008 20:41:37 +0000
parents 4352d41affb0
children 23ab586c427a
line wrap: on
line diff
--- a/Modules/_tkinter.c	Sat Apr 05 19:47:23 2008 +0000
+++ b/Modules/_tkinter.c	Sat Apr 05 20:41:37 2008 +0000
@@ -3012,7 +3012,7 @@
 PyMODINIT_FUNC
 init_tkinter(void)
 {
-	PyObject *m, *d;
+	PyObject *m, *d, *uexe, *cexe;
 
 	Py_TYPE(&Tkapp_Type) = &PyType_Type;
 
@@ -3065,7 +3065,16 @@
 
 	/* This helps the dynamic loader; in Unicode aware Tcl versions
 	   it also helps Tcl find its encodings. */
-	Tcl_FindExecutable(Py_GetProgramName());
+	uexe = PyUnicode_FromWideChar(Py_GetProgramName(), -1);
+	if (uexe) {
+		cexe = PyUnicode_AsEncodedString(uexe, 
+						 Py_FileSystemDefaultEncoding, 
+						 NULL);
+		if (cexe)
+			Tcl_FindExecutable(PyString_AsString(cexe));
+		Py_XDECREF(cexe);
+		Py_DECREF(uexe);
+	}
 
 	if (PyErr_Occurred())
 		return;