Mercurial > cpython-lru_cache-weakref
diff Objects/stringlib/formatter.h @ 55511:55e02fa7a11c
Merged revisions 74269 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74269 | eric.smith | 2009-07-30 09:39:44 -0400 (Thu, 30 Jul 2009) | 1 line
Issue 6330: Fix --enable-unicode=ucs4.
........
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Thu, 30 Jul 2009 13:43:08 +0000 |
| parents | 06b86a6e28f1 |
| children | 915a044be834 |
line wrap: on
line diff
--- a/Objects/stringlib/formatter.h Thu Jul 30 10:02:09 2009 +0000 +++ b/Objects/stringlib/formatter.h Thu Jul 30 13:43:08 2009 +0000 @@ -32,7 +32,7 @@ PyErr_Format(PyExc_ValueError, "Unknown format code '%c' " "for object of type '%.200s'", - presentation_type, + (char)presentation_type, type_name); #if STRINGLIB_IS_UNICODE else @@ -44,6 +44,24 @@ #endif } +static void +invalid_comma_type(STRINGLIB_CHAR presentation_type) +{ +#if STRINGLIB_IS_UNICODE + /* See comment in unknown_presentation_type */ + if (presentation_type > 32 && presentation_type < 128) +#endif + PyErr_Format(PyExc_ValueError, + "Cannot specify ',' with '%c'.", + (char)presentation_type); +#if STRINGLIB_IS_UNICODE + else + PyErr_Format(PyExc_ValueError, + "Cannot specify ',' with '\\x%x'.", + (unsigned int)presentation_type); +#endif +} + /* get_integer consumes 0 or more decimal digit characters from an input string, updates *result with the corresponding positive @@ -253,8 +271,7 @@ /* These are allowed. See PEP 378.*/ break; default: - PyErr_Format(PyExc_ValueError, - "Cannot specify ',' with '%c'.", format->type); + invalid_comma_type(format->type); return 0; } }
