self.assertRaises(ValueError, 3 .__format__, ",n")
# can't have ',' with 'c'
self.assertRaises(ValueError, 3 .__format__, ",c")
- # can't have '#' with 'c'
- self.assertRaises(ValueError, 3 .__format__, "#c")
# ensure that only int and float type specifiers work
for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] +
replacement fields. It now matches the behavior of str.format() in
this regard. Patches by Phil Elson and Ramchandra Apte.
-- Issue #8931: Make alternate formatting ('#') for type 'c' raise an
- exception. It had no effect, now trying to specify it is an error.
- Patch by Torsten Landschoff.
-
Library
-------
" 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 */