diff options
author | Eric V. Smith <eric@trueblade.com> | 2014-04-15 22:37:55 -0400 |
---|---|---|
committer | Eric V. Smith <eric@trueblade.com> | 2014-04-15 22:37:55 -0400 |
commit | a54ab6a21c2d2a11098e73a4e9a72020496ecca4 (patch) | |
tree | 8e430ce0ad007df713840d84228725a4bd9183b2 /Python/formatter_unicode.c | |
parent | 1c6826404100e9a3987a0cf820416dc3e2a70eec (diff) | |
download | cpython-a54ab6a21c2d2a11098e73a4e9a72020496ecca4.tar.gz |
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.c | 7 |
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 */ |