Commit 80d07f82 authored by Benjamin Peterson's avatar Benjamin Peterson

inherit maxchar of field value where needed (closes #14648)

parent 1cf5aa91
......@@ -1056,6 +1056,8 @@ class UnicodeTest(string_tests.CommonTest,
self.assertEqual('%f' % INF, 'inf')
self.assertEqual('%F' % INF, 'INF')
self.assertEqual(format("\u0410\u0411\u0412", "s"), "АБВ")
def test_startswith_endswith_errors(self):
for meth in ('foo'.startswith, 'foo'.endswith):
with self.assertRaises(TypeError) as cm:
......
......@@ -747,6 +747,9 @@ format_string_internal(PyObject *value, const InternalFormatSpec *format)
len = format->precision;
}
if (len)
maxchar = PyUnicode_MAX_CHAR_VALUE(value);
calc_padding(len, format->width, format->align, &lpad, &rpad, &total);
if (lpad != 0 || rpad != 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment