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 boramalper
Recipients boramalper
Date 2017-03-28.14:37:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490711861.33.0.140733331075.issue29934@psf.upfronthosting.co.za>
In-reply-to
Content
Hello,

In Python 3.6.0, % formatting fails to find formatting code after a null byte in bytes type.

Example:
    >>> "%s_\x00%s" % ("hello", "world")
    'hello_\x00world'
    >>> b"%s_\x00%s" % (b"hello", b"world")
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: not all arguments converted during bytes formatting

In contrast, the exact same code works as expected in Python 3.5:

    >>> "%s_\x00%s" % ("hello", "world")
    'hello_\x00world'
    >>> b"%s_\x00%s" % (b"hello", b"world")
    b'hello_\x00world'

I used Python 3.6.0 that I installed using pyenv 1.0.8 on Kubuntu 16.04 x86_64.
History
Date User Action Args
2017-03-28 14:37:41boramalpersetrecipients: + boramalper
2017-03-28 14:37:41boramalpersetmessageid: <1490711861.33.0.140733331075.issue29934@psf.upfronthosting.co.za>
2017-03-28 14:37:41boramalperlinkissue29934 messages
2017-03-28 14:37:41boramalpercreate