This is present in 6.3.0 and 7.0.0. I didn't test earlier versions yet. bytes(1,2,3) should raise an error, but it doesn't.
>>> bytes(1,2,3)
b'\x00'
>>> bytes((1,2,3))
b'\x01\x02\x03'
Same is true for bytearray. bytes() does not take the contents as a variable number of arguments. It needs a sequence as the first arg.
CPython:
>>> bytes(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: bytes() argument 2 must be str, not int
MicroPython (tested on 1.12 and 1.16):
>>> bytes(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: wrong number of arguments
This is present in 6.3.0 and 7.0.0. I didn't test earlier versions yet.
bytes(1,2,3)should raise an error, but it doesn't.Same is true for
bytearray.bytes()does not take the contents as a variable number of arguments. It needs a sequence as the first arg.CPython:
MicroPython (tested on 1.12 and 1.16):