Message236056
PEP 461 says that all numeric bytes formatting codes will work as they do for str. In particular b"%x" % val is equivalent to ("%x" % val).encode("ascii"). But this is wrong with current implementation:
>>> '%x' % 3.14
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: %x format: an integer is required, not float
>>> b'%x' % 3.14
b'3'
The same is for %X, %o and %c.
Raising TypeError on non-integer input to %c, %o, %x, and %X was added in issue19995. |
|
Date |
User |
Action |
Args |
2015-02-15 18:21:46 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ethan.furman |
2015-02-15 18:21:46 | serhiy.storchaka | set | messageid: <1424024506.86.0.140677708328.issue23466@psf.upfronthosting.co.za> |
2015-02-15 18:21:46 | serhiy.storchaka | link | issue23466 messages |
2015-02-15 18:21:46 | serhiy.storchaka | create | |
|