mirror of
https://github.com/python/cpython.git
synced 2025-07-17 08:15:19 +00:00
Closed issue #8931: Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.
This commit is contained in:
parent
9417764e01
commit
a0d107324d
3 changed files with 13 additions and 0 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue