New submission from Jörn Heissler <launch...@joern.heissler.de>: Hi,
the ipaddress module accepts `bytes' objects in the constructors. `bytearray' however is not supported, see paste below. Should this be supported too? >>> import ipaddress >>> ipaddress.IPv4Address(bytes([127, 0, 0, 1])) IPv4Address('127.0.0.1') >>> ipaddress.IPv4Address(bytearray([127, 0, 0, 1])) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.7/ipaddress.py", line 1301, in __init__ self._ip = self._ip_int_from_string(addr_str) File "/usr/lib/python3.7/ipaddress.py", line 1135, in _ip_int_from_string raise AddressValueError("Expected 4 octets in %r" % ip_str) ipaddress.AddressValueError: Expected 4 octets in "bytearray(b'\\x7f\\x00\\x00\\x01')" ---------- components: Library (Lib) messages: 323906 nosy: joernheissler priority: normal severity: normal status: open title: ipaddress should accept bytearray in addition to bytes type: enhancement versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34465> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com