From: Andrew M. Kuchling Date: Tue, 19 Dec 2000 22:49:06 +0000 (+0000) Subject: Patch #102940: use only printable Unicode chars in reporting X-Git-Tag: v2.1a1~514 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f947ffe951ebf2c194a2d566c3b524d40e96251e;p=python Patch #102940: use only printable Unicode chars in reporting incorrect % characters; characters outside the printable range are replaced with '?' --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 4438e89eaf..fe591b52a4 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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) {