summaryrefslogtreecommitdiffstats
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorEric V. Smith <eric@trueblade.com>2014-04-16 02:37:55 (GMT)
committerEric V. Smith <eric@trueblade.com>2014-04-16 02:37:55 (GMT)
commita12572ff3a62878f70cfb8fd4cf8c6bc4ac1ba98 (patch)
tree3d395e27f831e78b5e9831ea1e855d4e125c303d /Python/formatter_unicode.c
parent15b04eb42902f84fa3e35387b0c7c3391a204f65 (diff)
downloadcpython-a12572ff3a62878f70cfb8fd4cf8c6bc4ac1ba98.zip
cpython-a12572ff3a62878f70cfb8fd4cf8c6bc4ac1ba98.tar.gz
cpython-a12572ff3a62878f70cfb8fd4cf8c6bc4ac1ba98.tar.bz2
Close 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 e3a8149..056bb76 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 */