[issue27460] Change bytes exception when overflow

Xiang Zhang report at bugs.python.org
Wed Jul 6 06:38:48 EDT 2016


New submission from Xiang Zhang:

I suggest change `bytes` exception message when an iterable containing overflow integers.

Right now, bytes([sys.maxsize+1]) emits ValueError: cannot fit 'int' into an index-sized integer "ValueError: cannot fit 'int' into an index-sized integer". I think actually when use bytes in such a situation we don't care the integer overflows or not, we only care if the integer is in range(0, 256) or not, just like what bytearray([sys.maxsize+1]) does.

----------
files: bytes_exception_msg.patch
keywords: patch
messages: 269879
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: Change bytes exception when overflow
Added file: http://bugs.python.org/file43637/bytes_exception_msg.patch

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


More information about the Python-bugs-list mailing list