summaryrefslogtreecommitdiff
path: root/Python/formatter_unicode.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2012-11-10 21:10:31 -0800
committerGregory P. Smith <greg@krypto.org>2012-11-10 21:10:31 -0800
commit22f9e65bb11ab8dee2562fe5bf4e19dc9ff87bf7 (patch)
treeb2ee3bf7504f2ef298b67d1e70b43138265fd626 /Python/formatter_unicode.c
parentf6128db16b5187864ee8da2078d87bd52539fcad (diff)
parentbbdd90ba3a4de0c56d65b1fcc6db37b2730119d6 (diff)
downloadcpython-22f9e65bb11ab8dee2562fe5bf4e19dc9ff87bf7.tar.gz
Fixes issue #14396: Handle the odd rare case of waitpid returning 0
when not expected in subprocess.Popen.wait().
Diffstat (limited to 'Python/formatter_unicode.c')
-rw-r--r--Python/formatter_unicode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/formatter_unicode.c b/Python/formatter_unicode.c
index aa62502dbe..0ce9862a20 100644
--- a/Python/formatter_unicode.c
+++ b/Python/formatter_unicode.c
@@ -757,7 +757,8 @@ format_string_internal(PyObject *value, const InternalFormatSpec *format,
goto done;
}
- if (format->width == -1 && format->precision == -1) {
+ if ((format->width == -1 || format->width <= len)
+ && (format->precision == -1 || format->precision >= len)) {
/* Fast path */
return _PyUnicodeWriter_WriteStr(writer, value);
}