diff Objects/unicodeobject.c @ 15631:552db8d83acd legacy-trunk

Patch #102940: use only printable Unicode chars in reporting incorrect % characters; characters outside the printable range are replaced with '?'
author Andrew M. Kuchling <amk@amk.ca>
date Tue, 19 Dec 2000 22:49:06 +0000
parents 0906c8e2c961
children bf9bb0e3dd34
line wrap: on
line diff
--- a/Objects/unicodeobject.c	Tue Dec 19 22:28:14 2000 +0000
+++ b/Objects/unicodeobject.c	Tue Dec 19 22:49:06 2000 +0000
@@ -5069,7 +5069,8 @@
 		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) {