New submission from Mert Bora Alper:

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.

----------
messages: 290724
nosy: boramalper
priority: normal
severity: normal
status: open
title: % formatting fails to find formatting code in bytes type after a null 
byte
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29934>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to