diff Modules/_tkinter.c @ 42887:d5fbb843b0a9

Tkinter binding involving Control-spacebar raises unicode error Issue1028
author Kurt B. Kaiser <kbk@shore.net>
date Mon, 27 Aug 2007 01:55:21 +0000
parents d4ee54a88485
children 2a3ca90008ff
line wrap: on
line diff
--- a/Modules/_tkinter.c	Sun Aug 26 23:53:58 2007 +0000
+++ b/Modules/_tkinter.c	Mon Aug 27 01:55:21 2007 +0000
@@ -1897,7 +1897,7 @@
 PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
 {
 	PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
-	PyObject *self, *func, *arg, *res;
+	PyObject *self, *func, *arg, *res, *s;
 	int i, rv;
 	Tcl_Obj *tres;
 
@@ -1914,7 +1914,13 @@
 		return PythonCmd_Error(interp);
 
 	for (i = 0; i < (argc - 1); i++) {
-		PyObject *s = PyUnicode_FromString(argv[i + 1]);
+		if (11 == (i + 1)) {  /* the %A arg is the unicode char */
+			char *a = argv[i + 1];
+			s = PyUnicode_FromUnicode((Py_UNICODE *) a, strlen(a));
+		}
+		else {
+			s = PyUnicode_FromString(argv[i + 1]);
+		}
 		if (!s || PyTuple_SetItem(arg, i, s)) {
 			Py_DECREF(arg);
 			return PythonCmd_Error(interp);