summaryrefslogtreecommitdiffstats
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-04-23 14:55:29 (GMT)
committerBenjamin Peterson <benjamin@python.org>2012-04-23 14:55:29 (GMT)
commit80d07f825108761af9fe2ac79c1ef50289c07c08 (patch)
treeb9c87aef9fe754677fd5eb6220419647343e7400 /Python/formatter_unicode.c
parent1cf5aa910649bd831cad8f87963277025deb0695 (diff)
downloadcpython-80d07f825108761af9fe2ac79c1ef50289c07c08.zip
cpython-80d07f825108761af9fe2ac79c1ef50289c07c08.tar.gz
cpython-80d07f825108761af9fe2ac79c1ef50289c07c08.tar.bz2
inherit maxchar of field value where needed (closes #14648)
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index 58e66e0..5e5b19f 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -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)