diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 22:49:06 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2000-12-19 22:49:06 (GMT) |
commit | f947ffe951ebf2c194a2d566c3b524d40e96251e (patch) | |
tree | 0f7b406232a5fd765eb0c67d29050b291da904de /Objects/unicodeobject.c | |
parent | 7ff3133a7fc9e6097a3674c55397a24a3f1f1e54 (diff) | |
download | cpython-f947ffe951ebf2c194a2d566c3b524d40e96251e.zip cpython-f947ffe951ebf2c194a2d566c3b524d40e96251e.tar.gz cpython-f947ffe951ebf2c194a2d566c3b524d40e96251e.tar.bz2 |
Patch #102940: use only printable Unicode chars in reporting
incorrect % characters; characters outside the printable range are
replaced with '?'
Diffstat (limited to 'Objects/unicodeobject.c')
-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 4438e89..fe591b5 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) { |