summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-12-17 20:15:10 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-12-17 20:15:10 (GMT)
commit9d16b616d50203543e408b6a1205945df2b2fd46 (patch)
treec34daf3a338bd131d70468b28468410fcf97f5dd /Objects
parent6c9dcda6b4e58367128726afc41fe05ee2f6388d (diff)
parent025f8953f1eff11d1eb3cb5d2068a31e6f6c7270 (diff)
downloadcpython-9d16b616d50203543e408b6a1205945df2b2fd46.zip
cpython-9d16b616d50203543e408b6a1205945df2b2fd46.tar.gz
cpython-9d16b616d50203543e408b6a1205945df2b2fd46.tar.bz2
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
form.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/bytesobject.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index 0a5c0ae..0df9033 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++;