mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
Close issue #8931: Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.
This commit is contained in:
parent
15b04eb429
commit
a12572ff3a
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