diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py index 15507d61dec8f9..8a42bf2a56ce6f 100644 --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1287,7 +1287,7 @@ def __init__(self, address): return # Constructing from a packed address - if isinstance(address, bytes): + if isinstance(address, (bytes, bytearray)): self._check_packed_address(address, 4) self._ip = int.from_bytes(address, 'big') return diff --git a/Misc/NEWS.d/next/Library/2018-08-25-02-38-50.bpo-34465.pMad01.rst b/Misc/NEWS.d/next/Library/2018-08-25-02-38-50.bpo-34465.pMad01.rst new file mode 100644 index 00000000000000..79b18df1e6b2d0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-08-25-02-38-50.bpo-34465.pMad01.rst @@ -0,0 +1 @@ +Added support for 'bytearray' type in creating a new IPv4 address. \ No newline at end of file