diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-17 19:48:03 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-17 19:48:03 (GMT) |
commit | b1a1619bf042cd9d51d83c5120cec51a6f27e906 (patch) | |
tree | e261941e21ecc0f46240f424d26487c2a3461887 /Objects | |
parent | af56e0e70f043ad2615eff403f46d7bc6c411aae (diff) | |
download | cpython-b1a1619bf042cd9d51d83c5120cec51a6f27e906.zip cpython-b1a1619bf042cd9d51d83c5120cec51a6f27e906.tar.gz cpython-b1a1619bf042cd9d51d83c5120cec51a6f27e906.tar.bz2 |
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
form.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 3934328..673bb00 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -882,7 +882,7 @@ _PyBytes_Format(PyObject *format, PyObject *args) if (width > len) width--; } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); if (fill != ' ') { @@ -904,8 +904,7 @@ _PyBytes_Format(PyObject *format, PyObject *args) if (fill == ' ') { if (sign) *res++ = sign; - if ((flags & F_ALT) && - (c == 'x' || c == 'X')) { + if ((flags & F_ALT) && (c == 'o' || c == 'x' || c == 'X')) { assert(pbuf[0] == '0'); assert(pbuf[1] == c); *res++ = *pbuf++; |