summaryrefslogtreecommitdiffstats
path: root/Modules/_tkinter.c
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2011-05-11 18:18:13 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2011-05-11 18:18:13 (GMT)
commit9dd41fa970c43ce7986689ae2f3be75545ea7427 (patch)
tree6dd2e4496a5c00d5d8991fa8c4fa1373dd9eeb5a /Modules/_tkinter.c
parentcaece0a6a02b9677e560c92469ab6665fbcb30eb (diff)
parent79a11e71c69b3862fc930a47bd628e481685f93b (diff)
downloadcpython-9dd41fa970c43ce7986689ae2f3be75545ea7427.zip
cpython-9dd41fa970c43ce7986689ae2f3be75545ea7427.tar.gz
cpython-9dd41fa970c43ce7986689ae2f3be75545ea7427.tar.bz2
Merge from 3.2
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r--Modules/_tkinter.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c
index 91b1b53..6879975 100644
--- a/Modules/_tkinter.c
+++ b/Modules/_tkinter.c
@@ -2022,7 +2022,19 @@ PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
for (i = 0; i < (argc - 1); i++) {
PyObject *s = PyUnicode_FromString(argv[i + 1]);
- if (!s || PyTuple_SetItem(arg, i, s)) {
+ if (!s) {
+ /* Is Tk leaking 0xC080 in %A - a "modified" utf-8 null? */
+ if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError) &&
+ !strcmp(argv[i + 1], "\xC0\x80")) {
+ PyErr_Clear();
+ /* Convert to "strict" utf-8 null */
+ s = PyUnicode_FromString("\0");
+ } else {
+ Py_DECREF(arg);
+ return PythonCmd_Error(interp);
+ }
+ }
+ if (PyTuple_SetItem(arg, i, s)) {
Py_DECREF(arg);
return PythonCmd_Error(interp);
}