]> granicus.if.org Git - python/commitdiff
Issue #13153: Tkinter functions now raise TclError instead of ValueError when
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 18 Feb 2013 11:02:41 +0000 (13:02 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 18 Feb 2013 11:02:41 +0000 (13:02 +0200)
a string argument contains non-BMP character.

1  2 
Misc/NEWS
Modules/_tkinter.c

diff --cc Misc/NEWS
Simple merge
index 70f47036d068d41c9a9e30815868ccca191218b8,c6a3e388ef3e293e711599a99fb5a3c92711b8ec..d18c7f06cb093a8316b67a72d696eb02fb8aaa9d
@@@ -984,16 -991,12 +984,16 @@@ AsObj(PyObject *value
              return NULL;
          }
          for (i = 0; i < size; i++) {
 -            if (inbuf[i] >= 0x10000) {
 +            Py_UCS4 ch = PyUnicode_READ(kind, inbuf, i);
 +            /* We cannot test for sizeof(Tcl_UniChar) directly,
 +               so we test for UTF-8 size instead. */
 +#if TCL_UTF_MAX == 3
 +            if (ch >= 0x10000) {
                  /* Tcl doesn't do UTF-16, yet. */
-                 PyErr_Format(PyExc_ValueError,
+                 PyErr_Format(Tkinter_TclError,
                               "character U+%x is above the range "
                               "(U+0000-U+FFFF) allowed by Tcl",
 -                             inbuf[i]);
 +                             ch);
                  ckfree(FREECAST outbuf);
                  return NULL;
              }