summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib/string_format.h
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2008-04-07 03:22:07 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2008-04-07 03:22:07 (GMT)
commit5a6f4585fdc52959bcc0dfdb9d25f2d34f983300 (patch)
tree889d39a1f6556e8aab23628d036b60e53cb1ab51 /Objects/stringlib/string_format.h
parentd218dc15e6b75d07450e4388c32e39c5741718bf (diff)
downloadcpython-5a6f4585fdc52959bcc0dfdb9d25f2d34f983300.zip
cpython-5a6f4585fdc52959bcc0dfdb9d25f2d34f983300.tar.gz
cpython-5a6f4585fdc52959bcc0dfdb9d25f2d34f983300.tar.bz2
Merged revisions 62199 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62199 | martin.v.loewis | 2008-04-07 05:08:28 +0200 (Mo, 07 Apr 2008) | 2 lines Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4. ........
Diffstat (limited to 'Objects/stringlib/string_format.h')
-rw-r--r--Objects/stringlib/string_format.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/Objects/stringlib/string_format.h b/Objects/stringlib/string_format.h
index 214b7b3..be8e8080 100644
--- a/Objects/stringlib/string_format.h
+++ b/Objects/stringlib/string_format.h
@@ -740,9 +740,17 @@ do_conversion(PyObject *obj, STRINGLIB_CHAR conversion)
case 's':
return STRINGLIB_TOSTR(obj);
default:
- PyErr_Format(PyExc_ValueError,
- "Unknown converion specifier %c",
- conversion);
+ if (conversion > 32 && conversion < 127) {
+ /* It's the ASCII subrange; casting to char is safe
+ (assuming the execution character set is an ASCII
+ superset). */
+ PyErr_Format(PyExc_ValueError,
+ "Unknown conversion specifier %c",
+ (char)conversion);
+ } else
+ PyErr_Format(PyExc_ValueError,
+ "Unknown conversion specifier \\x%x",
+ (unsigned int)conversion);
return NULL;
}
}