[issue12546] builtin __format__ methods cannot fill with \x00 char

Eric V. Smith report at bugs.python.org
Mon May 19 17:15:04 CEST 2014


Eric V. Smith added the comment:

For int, the spec is:
[[fill]align][sign][#][0][width][,][.precision][type]

So, for "06d", "0" is matched as the literal 0, "6" is matched as width, and "d" is matched as type.

For "\x00<6d", "\x00" is matched as fill, "<" as align, "6" as width, and "d" as type.

For "\x006d", there's no align. So "\x00" cannot match as fill. "\x00" doesn't match anything else, so it's an invalid format specifier, thus the exception.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12546>
_______________________________________


More information about the Python-bugs-list mailing list