diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-17 22:13:05 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-12-17 22:13:05 +0200 |
commit | 025f8953f1eff11d1eb3cb5d2068a31e6f6c7270 (patch) | |
tree | e7ff669617e6385c645289853443170d1eb770dc /Objects/bytesobject.c | |
parent | 75862c4c66cb23edbaf1b370cb7a355108edfd49 (diff) | |
parent | b1a1619bf042cd9d51d83c5120cec51a6f27e906 (diff) | |
download | cpython-git-025f8953f1eff11d1eb3cb5d2068a31e6f6c7270.tar.gz |
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
form.
Diffstat (limited to 'Objects/bytesobject.c')
-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 779fe295db..b22e57effe 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -974,7 +974,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, /* Write the numeric prefix for "x", "X" and "o" formats if the alternate form is used. For example, write "0x" for the "%#x" format. */ - 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 != ' ') { @@ -999,8 +999,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len, 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++; |