[New-bugs-announce] [issue38784] ip_network does not clear/update the broadcast_address cache when the IP address is changed.

Johannes Erwerle report at bugs.python.org
Wed Nov 13 03:08:43 EST 2019


New submission from Johannes Erwerle <jo at swagspace.org>:

The ip_network class in the ipaddress module does cache the broadcast_address attribute.
But when the network address is changed the cache is not cleared/updated.

Example:

> from ipaddress import ip_network
> 
> print("------------------------------")
> 
> net = ip_network("10.0.0.0/8")
> print("net", net)
> print("broadcast_address", net.broadcast_address)
> print("increase")
> net.network_address += 2**24
> print("net", net)
> print("net.broadcast_address", net.broadcast_address)
>
> print("------------------------------")
>
> net2 = ip_network("10.0.0.0/8")
> print("net2", net2)
> print("no call to broadcast_address")
> print("increase")
> net2.network_address += 2**24
> print("net2", net2)
> print("net2.broadcast_address", net2.broadcast_address)

----------
messages: 356522
nosy: 992jo
priority: normal
severity: normal
status: open
title: ip_network does not clear/update the broadcast_address cache when  the IP address is changed.
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list