[New-bugs-announce] [issue27572] Support bytes-like objects when base is given to int()
Xiang Zhang
report at bugs.python.org
Tue Jul 19 04:56:16 EDT 2016
New submission from Xiang Zhang:
Right now, int() supports bytes-like objects when *base* is not given:
>>> int(memoryview(b'100'))
100
When *base* is given bytes-like objects are not supported:
>>> int(memoryview(b'100'), base=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: int() can't convert non-string with explicit base
Is there any obvious reason not to support it when *base* is given? I suggest add it.
----------
components: Interpreter Core
files: bytes_like_support_to_int.patch
keywords: patch
messages: 270818
nosy: martin.panter, xiang.zhang
priority: normal
severity: normal
status: open
title: Support bytes-like objects when base is given to int()
versions: Python 3.6
Added file: http://bugs.python.org/file43789/bytes_like_support_to_int.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27572>
_______________________________________
More information about the New-bugs-announce
mailing list