Repository navigation
Conversation
rthalley
pushed a commit
that referenced
this pull request
Oct 17, 2026
(cherry picked from commit 1185be6)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RRset[-1]andAnswer[-1]currently raiseValueErrorinstead of returning the last record in their iteration order. Negative integer deletion fails through the same path, and out-of-range integer indices leakStopIterationorValueErrorinstead ofIndexError.For example, on main (
ff7c868439ba8f8e27590bf6cc5dc5ff0d6a485a, 2.10.0dev0), this fails without any DNS query:Normalize negative integer indices and check bounds in
Set.__getitem__before callingislice. RRset and Answer indexing/deletion inherit the fix. This restores the integer behavior of the earlier list-backed implementation while retaining dictionary storage and streaming lookup. The tests cover positive/negative positions, empty/nonempty bounds, huge integers, deletion without mutation on invalid indices, and Answer forwarding through a deterministic wire round trip.Validation on macOS ARM64, CPython 3.13.12:
NO_INTERNET=1 python -m pytest -q --cov=dns.set --cov-branch --cov-report=term-missingreports 1,503 passed, 123 skipped, 98 subtests passed.dns/set.pyhas 100% statement and branch coverage.dns; Ty passes ondns/set.py;git diff --checkpasses.dns/entropy.pyandtests/test_entropy.py. Whole-tree Ty still reports the same threepublic_clsmutable-override errors indnssecalgsand one unused-ignore warning indns/rdtypes/rrsigbase.py; pristine and patched Ty output is byte-identical.The 123 skips include external-network tests. This validation does not establish live DNS behavior, hosted CI success, or other-platform/Python-version results. The fix is scoped to integer scalar indexing and bounds; it makes no broader slice or index-protocol compatibility claim and adds no DNS preference-order guarantee.
AI assistance was used to prepare the implementation and regression tests.
Independent validation of the exact patch reproduced the failures against the base and ran the patched offline suite and additional scalar probes.