]> granicus.if.org Git - python/commitdiff
Patch #102940: use only printable Unicode chars in reporting
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 19 Dec 2000 22:49:06 +0000 (22:49 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 19 Dec 2000 22:49:06 +0000 (22:49 +0000)
 incorrect % characters; characters outside the printable range are
 replaced with '?'

Objects/unicodeobject.c

index 4438e89eaf43a725cb9d4c8301f67cdfe87cddaf..fe591b52a4965951a7fb8fd0e9eb2addcf0097b8 100644 (file)
@@ -5069,7 +5069,8 @@ PyObject *PyUnicode_Format(PyObject *format,
                PyErr_Format(PyExc_ValueError,
                             "unsupported format character '%c' (0x%x) "
                             "at index %i",
-                            c, c, fmt -1 - PyUnicode_AS_UNICODE(uformat));
+                            (31<=c && c<=126) ? c : '?', 
+                             c, fmt -1 - PyUnicode_AS_UNICODE(uformat));
                goto onError;
            }
            if (sign) {