Repository navigation
Use c-ares flags for asynchronous DNS resolution - #14088
JackyHsu-X wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #14088 +/- ##
=======================================
Coverage 99.09% 99.09%
=======================================
Files 135 135
Lines 53551 53566 +15
Branches 2809 2809
=======================================
+ Hits 53067 53082 +15
Misses 364 364
Partials 120 120
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
|

What do these changes do?
Use c-ares flag values for
AsyncResolver.getaddrinfo()and the scoped-IPv6getnameinfo()call. The socket constants differ across platforms and aiodns/pycares pass them through unchanged. Keep socket flags forThreadedResolverand for the returnedResolveResult.The c-ares masks are defined locally because pycares does not publicly export
ARES_AI_*. The values followinclude/ares.h; this avoids depending on a private pycares API.Are there changes in behavior for the user?
The asynchronous backend requests address-configuration filtering and numeric host/service output with the intended flags. Windows localhost retry still uses zero flags.
Is it a substantial burden for the maintainers to support this?
Two private constants and two call-site changes; no public API or dependency changes. Regression tests cover differing platform flag values, the existing localhost fallback, and a real numeric aiodns lookup.
Related issue number
Fixes #14087.
Checklist
CONTRIBUTORS.txtCHANGES/14087.bugfix.rst, withCHANGES/14088.bugfix.rstlinking to it as requested inAGENTS.md.Reviewed by @JackyHsu-X. Ready for maintainer review.
Local validation run by the agent (Windows, Python 3.12.8, pure Python mode)
pytest tests/test_resolver.py tests/test_connector.py tests/test_client_proto.py -n 4 --no-cov -q: 259 passed, 6 skipped, 1 xfailed.pytest tests/test_client_functional.py -n 4 --no-cov -q: 340 passed, 1 xfailed.AsyncResolverandThreadedResolver: passed.--shadow-file(Windows-only APIs and missing optional development dependencies among them).The complete test suite, Linux matrix, and compiled extensions were not run. This change does not touch parsers or WebSockets.
Drafted with OpenAI Codex (GPT-6); reviewed by @JackyHsu-X.