[issue27623] int.to_bytes() and int.from_bytes(): raise ValueError when bytes count is zero

Martin Panter report at bugs.python.org
Fri Jul 29 21:21:55 EDT 2016


Martin Panter added the comment:

I’m not familiar with the implementation, but it does seem like this should be fixed within _PyLong_AsByteArray().

Also, what about int.from_bytes(b"", ..., signed=True)? There are existing tests for this case, but it seems like it should be an error, rather than returning zero.

----------

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


More information about the Python-bugs-list mailing list