diff options
author | Eric V. Smith <eric@trueblade.com> | 2014-04-15 07:05:02 (GMT) |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2014-04-15 07:05:02 (GMT) |
commit | a0d107324d38ab6fc5af4c6fee272e1097f98f49 (patch) | |
tree | aed38f812bcc7556a1899b4756e7af94fd909ab4 /Python/formatter_unicode.c | |
parent | 9417764e0164711886ee5416204b59ec47ef54c7 (diff) | |
download | cpython-a0d107324d38ab6fc5af4c6fee272e1097f98f49.zip cpython-a0d107324d38ab6fc5af4c6fee272e1097f98f49.tar.gz cpython-a0d107324d38ab6fc5af4c6fee272e1097f98f49.tar.bz2 |
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.c | 7 |
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 */ |