summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-12-19 22:49:06 +0000
committerAndrew M. Kuchling <amk@amk.ca>2000-12-19 22:49:06 +0000
commitbbc2422c60a77951c806a53a31af7e7a40dddb02 (patch)
treeacba0ca910ea4b0f97f036eacd0124c8e2e73b24 /Objects
parent66bb82a89ac720ba81cb09cdba6167f8bfeb274c (diff)
downloadcpython-bbc2422c60a77951c806a53a31af7e7a40dddb02.tar.gz
Patch #102940: use only printable Unicode chars in reporting
incorrect % characters; characters outside the printable range are replaced with '?'
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
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) {