From: Serhiy Storchaka Date: Sat, 17 Dec 2016 20:13:05 +0000 (+0200) Subject: Issue #29000: Fixed bytes formatting of octals with zero padding in alternate X-Git-Tag: v3.6.1rc1~292 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=025f8953f1eff11d1eb3cb5d2068a31e6f6c7270;p=thirdparty%2FPython%2Fcpython.git Issue #29000: Fixed bytes formatting of octals with zero padding in alternate form. --- 025f8953f1eff11d1eb3cb5d2068a31e6f6c7270 diff --cc Misc/NEWS index 883ca6eaeb64,6a29ec8cdbfc..ed10395f54a1 --- a/Misc/NEWS +++ 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(). diff --cc Objects/bytesobject.c index 779fe295db00,673bb00b9843..b22e57effe6a --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@@ -970,11 -881,8 +970,11 @@@ _PyBytes_FormatEx(const char *format, P if (width > len) width--; } + + /* 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 != ' ') {