Raise ARES_ENODATA when convert_result has no matching records#254
Merged
Conversation
NOERROR/NODATA responses for non-ANY qtypes used to silently return [] from convert_result. For CNAME/SOA/PTR that crashed callers reading .name/.cname/.nsname; for A/AAAA/MX/NS/TXT/SRV/NAPTR/CAA it diverged from the pycares 4.x raise-on-NODATA contract this compat layer is meant to preserve. convert_result now raises DNSError(ARES_ENODATA) on empty/no-matching answers, and _query_callback routes that through set_exception. ANY stays list-shaped as before.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #254 +/- ##
==========================================
+ Coverage 98.42% 98.46% +0.03%
==========================================
Files 5 5
Lines 1399 1433 +34
Branches 73 74 +1
==========================================
+ Hits 1377 1411 +34
Misses 16 16
Partials 6 6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
confirmed report and fix double checked against pycares 4.x and aiodns 3. behavior now matches |
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.
What do these changes do?
convert_resultused to return[]whenever the answer section had no records matching the requested qtype (NOERROR/NODATA, or only records of other types). For CNAME, SOA, and PTR that crashed callers reading.name,.cname, or.nsname; for the other qtypes it silently diverged from the pycares 4.x raise on NODATA contract this compat layer is meant to preserve. It now raisesDNSError(ARES_ENODATA), and_query_callbackroutes that throughset_exception. ANY is unchanged.Are there changes in behavior for the user?
Yes;
query()for qtypes other than ANY will raiseaiodns.error.DNSError(ARES_ENODATA)on NODATA answers instead of returning an empty list or, for CNAME/SOA/PTR, crashing the caller withAttributeError. Matches the pycares 4.x behaviour.Related issue number
Checklist