Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 809f90f

Browse files
committed
Reverted 16efa8d27e4c after discussion with Eric.
1 parent 1e53f8d commit 809f90f

3 files changed

Lines changed: 0 additions & 13 deletions

File tree

Lib/test/test_types.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ def test(i, format_spec, result):
343343
self.assertRaises(ValueError, 3 .__format__, ",n")
344344
# can't have ',' with 'c'
345345
self.assertRaises(ValueError, 3 .__format__, ",c")
346-
# can't have '#' with 'c'
347-
self.assertRaises(ValueError, 3 .__format__, "#c")
348346

349347
# ensure that only int and float type specifiers work
350348
for format_spec in ([chr(x) for x in range(ord('a'), ord('z')+1)] +

Misc/NEWS

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ Core and Builtins
3434
replacement fields. It now matches the behavior of str.format() in
3535
this regard. Patches by Phil Elson and Ramchandra Apte.
3636

37-
- Issue #8931: Make alternate formatting ('#') for type 'c' raise an
38-
exception. It had no effect, now trying to specify it is an error.
39-
Patch by Torsten Landschoff.
40-
4137
Library
4238
-------
4339

Python/formatter_unicode.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,6 @@ format_long_internal(PyObject *value, const InternalFormatSpec *format,
846846
" format specifier 'c'");
847847
goto done;
848848
}
849-
/* error to request alternate format */
850-
if (format->alternate) {
851-
PyErr_SetString(PyExc_ValueError,
852-
"Alternate form (#) not allowed with integer"
853-
" format specifier 'c'");
854-
goto done;
855-
}
856849

857850
/* taken from unicodeobject.c formatchar() */
858851
/* Integer input truncated to a character */

0 commit comments

Comments
 (0)