diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2011-05-11 17:48:54 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2011-05-11 17:48:54 (GMT) |
commit | bc3e13818be01868117716bff6e6ed47609500bd (patch) | |
tree | 9785321f59552940174b3eacc224fc1c487dc416 /Modules/_tkinter.c | |
parent | 57e6eac9056982bc6f4f18da0b6efacd1a19e3ae (diff) | |
parent | e147806da9b138e53d86f0a2569a107f6a975834 (diff) | |
download | cpython-bc3e13818be01868117716bff6e6ed47609500bd.zip cpython-bc3e13818be01868117716bff6e6ed47609500bd.tar.gz cpython-bc3e13818be01868117716bff6e6ed47609500bd.tar.bz2 |
Merge from 3.1
Diffstat (limited to 'Modules/_tkinter.c')
-rw-r--r-- | Modules/_tkinter.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index c7c1530..cb2795f 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -2023,7 +2023,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); } |