Skip to content

gh-78646: Added support for bytearrray type , to create IPv4 addresss #8908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion Lib/ipaddress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for 'bytearray' type in creating a new IPv4 address.