This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients ethan.furman, serhiy.storchaka
Date 2015-02-15.18:21:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424024506.86.0.140677708328.issue23466@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-02-15 18:21:46serhiy.storchakasetrecipients: + serhiy.storchaka, ethan.furman
2015-02-15 18:21:46serhiy.storchakasetmessageid: <1424024506.86.0.140677708328.issue23466@psf.upfronthosting.co.za>
2015-02-15 18:21:46serhiy.storchakalinkissue23466 messages
2015-02-15 18:21:46serhiy.storchakacreate