diff options
Diffstat (limited to 'Objects/stringlib/formatter.h')
| -rw-r--r-- | Objects/stringlib/formatter.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/stringlib/formatter.h b/Objects/stringlib/formatter.h index 122abe6..b75755e 100644 --- a/Objects/stringlib/formatter.h +++ b/Objects/stringlib/formatter.h @@ -789,6 +789,7 @@ format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format, x = PyLong_AsLong(value); if (x == -1 && PyErr_Occurred()) goto done; +#if STRINGLIB_IS_UNICODE #ifdef Py_UNICODE_WIDE if (x < 0 || x > 0x10ffff) { PyErr_SetString(PyExc_OverflowError, @@ -804,6 +805,13 @@ format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format, goto done; } #endif +#else + if (x < 0 || x > 0xff) { + PyErr_SetString(PyExc_OverflowError, + "%c arg not in range(0x100)"); + goto done; + } +#endif numeric_char = (STRINGLIB_CHAR)x; pnumeric_chars = &numeric_char; n_digits = 1; |
