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