Skip to content

ipaddress: IPv6Network.is_global violates documented endpoint classification rule #158726

Description

@augusto-rehfeldt

Bug report

Bug description:

Documented behaviour: Python ipaddress documentation, IPv4Network/IPv6Network classification attributes: "These attributes are true for the network as a whole if they are true for both the network address and the broadcast address." This includes is_global.

Expected: IPv6Network('::/0').is_global is False, matching the conjunction of its endpoints' is_global values.

Actual: IPv6Network('::/0').is_global is True.

import ipaddress

s = "::/0"
try:
    n = ipaddress.IPv6Network(s, strict=True)
except ValueError as e:
    print("REFUTATION REJECTED:", e)
else:
    actual = n.is_global
    expected = n.network_address.is_global and n.broadcast_address.is_global
    if actual != expected:
        print(f"REFUTATION CONFIRMED: {s!r} actual={actual} expected={expected}")
    else:
        print("REFUTATION REJECTED: result matches documented endpoint rule")

Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library ipaddress:

REFUTATION CONFIRMED: '::/0' actual=True expected=False

This report was found and written by an automated property-testing tool I run (bugforge). The reproducer above was executed and its output is pasted unedited; no person reviewed the report before it was filed. The search script is in https://github.com/augusto-rehfeldt/bugforge-results/tree/main/ipaddress-20261003-190337-c3

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions