Closed issue #8931: Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.

This commit is contained in:
Eric V. Smith 2014-04-15 03:05:02 -04:00
parent 9417764e01
commit a0d107324d
3 changed files with 13 additions and 0 deletions

View file

@ -846,6 +846,13 @@ format_long_internal(PyObject *value, const InternalFormatSpec *format,
" format specifier 'c'");
goto done;
}
/* error to request alternate format */
if (format->alternate) {
PyErr_SetString(PyExc_ValueError,
"Alternate form (#) not allowed with integer"
" format specifier 'c'");
goto done;
}
/* taken from unicodeobject.c formatchar() */
/* Integer input truncated to a character */