From: Serhiy Storchaka Date: Mon, 18 Feb 2013 11:00:08 +0000 (+0200) Subject: Issue #13153: Tkinter functions now raise TclError instead of ValueError when X-Git-Tag: v2.7.4rc1~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4676448941b8fbfd941b77f1802d44fddc87e675;p=python Issue #13153: Tkinter functions now raise TclError instead of ValueError when a unicode argument contains non-BMP character. --- diff --git a/Misc/NEWS b/Misc/NEWS index 5924366d95..ef3d053109 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -205,6 +205,9 @@ Core and Builtins Library ------- +- Issue #13153: Tkinter functions now raise TclError instead of ValueError when + a unicode argument contains non-BMP character. + - Issue #9669: Protect re against infinite loops on zero-width matching in non-greedy repeat. Patch by Matthew Barnett. diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c index 40c8be2ce7..7872df3bf1 100644 --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -987,8 +987,10 @@ AsObj(PyObject *value) for (i = 0; i < size; i++) { if (inbuf[i] >= 0x10000) { /* Tcl doesn't do UTF-16, yet. */ - PyErr_SetString(PyExc_ValueError, - "unsupported character"); + PyErr_Format(Tkinter_TclError, + "character U+%x is above the range " + "(U+0000-U+FFFF) allowed by Tcl", + (int)inbuf[i]); ckfree(FREECAST outbuf); return NULL; }