New submission from Johannes Erwerle <[email protected]>:
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 <[email protected]>
<https://bugs.python.org/issue38784>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com