[New-bugs-announce] [issue20335] bytes constructor accepts more than one argument even of the first one is not a string

Renaud Blanch report at bugs.python.org
Tue Jan 21 22:45:37 CET 2014


New submission from Renaud Blanch:

% python3
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 13:52:24) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> help(bytes)
bytes constructor accepts more than one argument even of the first one is not a string (and then the other arguments are checked to be strings):

    >>> bytes(2, "foo", "bar")
    b'\x00\x00'
    >>> bytes(2, "foo")
    b'\x00\x00'

but:

    >>> bytes(2, 1)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: bytes() argument 2 must be str, not int

----------
components: Interpreter Core
messages: 208707
nosy: rndblnch
priority: normal
severity: normal
status: open
title: bytes constructor accepts more than one argument even of the first one is not a string
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20335>
_______________________________________


More information about the New-bugs-announce mailing list