diff options
| author | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 22:49:06 +0000 |
|---|---|---|
| committer | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 22:49:06 +0000 |
| commit | bbc2422c60a77951c806a53a31af7e7a40dddb02 (patch) | |
| tree | acba0ca910ea4b0f97f036eacd0124c8e2e73b24 | |
| parent | 66bb82a89ac720ba81cb09cdba6167f8bfeb274c (diff) | |
| download | cpython-bbc2422c60a77951c806a53a31af7e7a40dddb02.tar.gz | |
Patch #102940: use only printable Unicode chars in reporting
incorrect % characters; characters outside the printable range are
replaced with '?'
| -rw-r--r-- | Objects/unicodeobject.c | 3 |
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) { |
