[New-bugs-announce] [issue41820] ipaddress Library gives me incorrect results

Anudeep Balla report at bugs.python.org
Sun Sep 20 02:46:37 EDT 2020


New submission from Anudeep Balla <anudeepballa07 at gmail.com>:

https://docs.python.org/3.8/library/ipaddress.html

import ipaddress


ADDRESSES = [
    '172.16.254.00'
]

for ip in ADDRESSES:
    addr = ipaddress.ip_address(ip)
    if addr.version==4:
        {
            print("true")
        }
    else:
        {
            print("false")
        }
Screen Shot 2020-09-20 at 1 33 30 AM

I tried to validate an invalid IPv4 address using IPaddress library from py 3.8.6 but somehow it considers any address ending with "00" to be valid.

I hope this is helpful to the community please let me know if the issue is with validation from your end or a bug in the library.

@AnudeepBalla

----------
components: Library (Lib)
messages: 377208
nosy: anudeepballa07
priority: normal
severity: normal
status: open
title: ipaddress Library gives me incorrect results
type: behavior
versions: Python 3.8

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


More information about the New-bugs-announce mailing list