summaryrefslogtreecommitdiff
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorEric V. Smith <eric@trueblade.com>2014-04-15 03:05:02 -0400
committerEric V. Smith <eric@trueblade.com>2014-04-15 03:05:02 -0400
commit10bf64ae21980e08eb3845e5afed33876ebd71d7 (patch)
tree6f851ecab747fa14641abe933c9f6732856fc5cc /Python/formatter_unicode.c
parent6e36df33d776df97b37c18e09344aa8c934d6cf9 (diff)
downloadcpython-10bf64ae21980e08eb3845e5afed33876ebd71d7.tar.gz
Closed issue #8931: Make alternate formatting for 'c' raise an exception. Patch by Torsten Landschoff.
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index e3a8149841..056bb76902 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -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 */