[New-bugs-announce] [issue21177] ValueError: byte must be in range(0, 256)

Konstantin Zemlyak report at bugs.python.org
Tue Apr 8 10:54:10 CEST 2014


New submission from Konstantin Zemlyak:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> bytearray([256])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: byte must be in range(0, 256)
>>> bytes([256])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: bytes must be in range(0, 256)
>>> 


Tested on 2.7, 3.2, 3.3, 3.4. Frankly, this looks like an off-by-one error to me.

----------
components: Interpreter Core
messages: 215744
nosy: zart
priority: normal
severity: normal
status: open
title: ValueError: byte must be in range(0, 256)
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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


More information about the New-bugs-announce mailing list