Mercurial > cpython-lru_cache-weakref
diff Objects/stringlib/formatter.h @ 46333:4e72489f16d0 legacy-trunk
Bug #2388: Fix gcc warnings when compiling with --enable-unicode=ucs4.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Mon, 07 Apr 2008 03:08:28 +0000 |
| parents | 4d29127f3fa0 |
| children | 206700d749f0 |
line wrap: on
line diff
--- a/Objects/stringlib/formatter.h Mon Apr 07 01:59:40 2008 +0000 +++ b/Objects/stringlib/formatter.h Mon Apr 07 03:08:28 2008 +0000 @@ -785,8 +785,19 @@ break; default: /* unknown */ - PyErr_Format(PyExc_ValueError, "Unknown conversion type %c", - format.type); + #if STRINGLIB_IS_UNICODE + /* If STRINGLIB_CHAR is Py_UNICODE, %c might be out-of-range, + hence the two cases. If it is char, gcc complains that the + condition below is always true, hence the ifdef. */ + if (format.type > 32 && format.type <128) + #endif + PyErr_Format(PyExc_ValueError, "Unknown conversion type %c", + (char)format.type); + #if STRINGLIB_IS_UNICODE + else + PyErr_Format(PyExc_ValueError, "Unknown conversion type '\\x%x'", + (unsigned int)format.type); + #endif goto done; }
