Honor raise_on_serial_went_backwards on both inbound_xfr paths - #1298
Merged
Conversation
dns.query.inbound_xfr() forwarded the flag on its TCP path but not its UDP one, and dns.asyncquery.inbound_xfr() did the opposite, so each implementation honored the option on exactly one of its two paths. For the async version that is the default path, since udp_mode defaults to UDPMode.NEVER. _inbound_xfr()'s default for the parameter is dropped as well: it is private, all five call sites now pass the flag, and the default is what turned the two missed call sites into silent no-ops rather than errors.
Owner
|
Thanks! |
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.
inbound_xfr()has two socket paths, and each implementation forwardsraise_on_serial_went_backwardson only one of them — opposite ones.dns.query.inbound_xfr()passes it on the TCP path but not the UDP one(
query.py:1725);dns.asyncquery.inbound_xfr()does the reverse(
asyncquery.py:962). For the async version that is the default path, sinceudp_modedefaults toUDPMode.NEVER, so the option never takes effect there.Against a nanonameserver answering an IXFR with an older serial, with the option
set to
False:NEVER)TRY_FIRST)Both failing cells raise
dns.xfr.SerialWentBackwards. Left at its default thecontrol raises everywhere, as it should.
_inbound_xfr()'s= Truedefault is what made both misses silent rather thanerrors, so it is dropped too — it is private and all five call sites now pass
the flag.
pyrightandtythen catch an omission at the sync call sites; theasync ones keep an existing blanket
# pyright: ignore(unrelated-> Anycomplaint) and stay unprotected. Happy to drop this part if you prefer the
default.
Tests parametrize both
udp_modevalues across sync, asyncio and trio, andassert both directions. Three of the six fail with the source reverted; the rest
cover the paths that were already correct.
No
whatsnewentry: the parameter is unreleased and the existing bullet alreadydescribes the behavior this makes true.
1347 passed / 123 skipped, up from 1341 / 123 on
main;black,ruff,pyrightandtyclean.