[issue43769] ipaddress module takes bytes input as valid ip address

Eric V. Smith report at bugs.python.org
Wed Apr 7 17:33:21 EDT 2021


Eric V. Smith <eric at trueblade.com> added the comment:

This is documented behavior. See https://docs.python.org/3/library/ipaddress.html#ipaddress.IPv4Address

"The following constitutes a valid IPv4 address:
...
     An integer packed into a bytes object of length 4 (most significant octet first).
"

And the example: 
>>> ipaddress.IPv4Address(b'\xC0\xA8\x00\x01')
IPv4Address('192.168.0.1')

So I'm going to close this as not a bug.

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43769>
_______________________________________


More information about the Python-bugs-list mailing list