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 <rep...@bugs.python.org>
<http://bugs.python.org/issue27572>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to