mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
form.
This commit is contained in:
parent
af56e0e70f
commit
b1a1619bf0
3 changed files with 31 additions and 11 deletions
|
@ -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++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue