[Python-3000-checkins] r57540 - python/branches/py3k/Modules/_tkinter.c

kurt.kaiser python-3000-checkins at python.org
Mon Aug 27 03:55:22 CEST 2007


Author: kurt.kaiser
Date: Mon Aug 27 03:55:21 2007
New Revision: 57540

Modified:
   python/branches/py3k/Modules/_tkinter.c
Log:
Tkinter binding involving Control-spacebar raises unicode error
Issue1028


Modified: python/branches/py3k/Modules/_tkinter.c
==============================================================================
--- python/branches/py3k/Modules/_tkinter.c	(original)
+++ python/branches/py3k/Modules/_tkinter.c	Mon Aug 27 03:55:21 2007
@@ -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);


More information about the Python-3000-checkins mailing list