]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 17 Dec 2016 20:13:05 +0000 (22:13 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 17 Dec 2016 20:13:05 +0000 (22:13 +0200)
form.

1  2 
Lib/test/test_format.py
Misc/NEWS
Objects/bytesobject.c

Simple merge
diff --cc Misc/NEWS
index 883ca6eaeb64ba826c3283b038264b6c08de1a34,6a29ec8cdbfc6c5d397dc1b4334b04964ae61a23..ed10395f54a17f29d7e0000614f2add959ab7d80
+++ b/Misc/NEWS
@@@ -10,16 -10,9 +10,19 @@@ What's New in Python 3.6.1 release cand
  Core and Builtins
  -----------------
  
+ - Issue #29000: Fixed bytes formatting of octals with zero padding in alternate
+   form.
 +- Issue #26919: On Android, operating system data is now always encoded/decoded
 +  to/from UTF-8, instead of the locale encoding to avoid inconsistencies with
 +  os.fsencode() and os.fsdecode() which are already using UTF-8.
 +
 +- Issue #28991:  functools.lru_cache() was susceptible to an obscure $
 +  bug triggerable by a monkey-patched len() function.
 +
 +- Issue #28739: f-string expressions no longer accepted as docstrings and
 +  by ast.literal_eval() even if they do not include expressions.
 +
  - Issue #28512: Fixed setting the offset attribute of SyntaxError by
    PyErr_SyntaxLocationEx() and PyErr_SyntaxLocationObject().
  
index 779fe295db00eda8f7a255a6029bacd84a692185,673bb00b984370dadf8cd5f7367b1619ab97d96b..b22e57effe6a1819682b3c1b2fd9f6e0e6603601
@@@ -970,11 -881,8 +970,11 @@@ _PyBytes_FormatEx(const char *format, P
                  if (width > len)
                      width--;
              }
-             if ((flags & F_ALT) && (c == 'x' || c == 'X')) {
 +
 +            /* 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 == 'o' || c == 'x' || c == 'X')) {
                  assert(pbuf[0] == '0');
                  assert(pbuf[1] == c);
                  if (fill != ' ') {