[New-bugs-announce] [issue21954] str(b'text') returns "b'text'" in interpreter

Dev Player report at bugs.python.org
Fri Jul 11 04:57:23 CEST 2014

New submission from Dev Player:

str(b'text') returns double quoted item with b prefix within the str() object as so: "b'text'" in python interpreter. It seems the "b" shouldn't be within the outter quotes or apart of the str() instance data.

Is this a bug or new syntax? I personally haven't see any documentation that this is the correct behavior. Nor did I find any previously register issue tickets.

>>>bchars_list = [b'o', b'n', b'e']
[b'o', b'n', b'e']
>>>[str(x) for x in bchars_list]
["b'o'", "b'n'", "b'e'"]

components: Interpreter Core
files: str bug.bmp
messages: 222718
nosy: devplayer
priority: normal
severity: normal
status: open
title: str(b'text') returns "b'text'" in interpreter
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file35923/str bug.bmp

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list