Bug report
Bug description:
Documented behaviour: Python ipaddress documentation, “Arithmetic operators”: “Addition and subtraction of integers with address objects are supported.” The “Comparison operators” section also states: “Same IPv6 addresses with different scope zone IDs are not equal.” Together these make scope significant to the additive identity invariant.
Expected: IPv6Address('fe80::1%eth0'), equal to the original address.
Actual: IPv6Address('fe80::1'), unequal to the original because its scope ID is lost.
import ipaddress
s = 'fe80::1%eth0'
try:
a = ipaddress.IPv6Address(s)
if not a.scope_id or '%' in a.scope_id:
print('REFUTATION REJECTED: invalid or empty scope ID')
else:
expected = ipaddress.IPv6Address(s) # Identity preserves the full address.
actual = a + 0
if actual != expected:
print('REFUTATION CONFIRMED:', repr(s), 'actual =', repr(actual),
'expected =', repr(expected))
else:
print('REFUTATION REJECTED: additive identity holds')
except Exception as e:
print('REFUTATION REJECTED:', type(e).__name__, str(e))
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library ipaddress:
REFUTATION CONFIRMED: 'fe80::1%eth0' actual = IPv6Address('fe80::1') expected = IPv6Address('fe80::1%eth0')
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-125643-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Bug report
Bug description:
Documented behaviour: Python ipaddress documentation, “Arithmetic operators”: “Addition and subtraction of integers with address objects are supported.” The “Comparison operators” section also states: “Same IPv6 addresses with different scope zone IDs are not equal.” Together these make scope significant to the additive identity invariant.
Expected: IPv6Address('fe80::1%eth0'), equal to the original address.
Actual: IPv6Address('fe80::1'), unequal to the original because its scope ID is lost.
Output on Python 3.14.6 (Windows-11-10.0.26220-SP0), standard library
ipaddress: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-125643-c1
CPython versions tested on:
3.14
Operating systems tested on:
Windows