Skip to content

gh-151769: Fix IPv6Address ordering to account for scope_id#151864

Open
factnn wants to merge 1 commit into
python:mainfrom
factnn:fix/ipv6-ordering-scope-id
Open

gh-151769: Fix IPv6Address ordering to account for scope_id#151864
factnn wants to merge 1 commit into
python:mainfrom
factnn:fix/ipv6-ordering-scope-id

Conversation

@factnn

@factnn factnn commented Jun 21, 2026

Copy link
Copy Markdown

Fixes #151769

IPv6Address.eq compares scope_id but lt (inherited from
_BaseAddress) only compared the integer address, breaking trichotomy
and making sorted() non-deterministic for addresses with the same
IP but different scope IDs.

Add lt to IPv6Address that compares by _ip first, then by
_scope_id (None sorts before any string).

@factnn factnn force-pushed the fix/ipv6-ordering-scope-id branch from 5540a9e to 7f9d2f4 Compare June 21, 2026 17:21
@da-woods

Copy link
Copy Markdown
Contributor

#151864?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IPv6Address ordering is scope-id-blind, breaking trichotomy and making sorted()/min()/max() non-deterministic for scoped addresses

2 participants