Skip to content

Fix Windows localhost resolution without active network#12700

Draft
oppnc wants to merge 1 commit into
aio-libs:masterfrom
oppnc:codex/fix-aiohttp-localhost-addrconfig
Draft

Fix Windows localhost resolution without active network#12700
oppnc wants to merge 1 commit into
aio-libs:masterfrom
oppnc:codex/fix-aiohttp-localhost-addrconfig

Conversation

@oppnc
Copy link
Copy Markdown

@oppnc oppnc commented May 25, 2026

What do these changes do?

Adds a Windows localhost fallback for resolver lookups that first fail with AI_ADDRCONFIG, retrying without the flag for both the threaded and async resolvers.

Are there changes in behavior for the user?

Yes. Windows users can resolve localhost while disconnected from active networks when the initial AI_ADDRCONFIG lookup fails.

Is it a substantial burden for the maintainers to support this?

No. The fallback is scoped to Windows localhost, only runs after the existing lookup fails, and is covered by resolver tests.

Related issue number

Fixes #5357

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
  • Add a new news fragment into the CHANGES/ folder

Validation:

  • PYTHONPATH=. AIOHTTP_NO_EXTENSIONS=1 pytest tests/test_resolver.py -q
  • python -m black --check aiohttp/resolver.py tests/test_resolver.py
  • python -m flake8 aiohttp/resolver.py tests/test_resolver.py

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label May 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.95%. Comparing base (7f0532c) to head (e3c05cf).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12700   +/-   ##
=======================================
  Coverage   98.95%   98.95%           
=======================================
  Files         131      131           
  Lines       46688    46733   +45     
  Branches     2421     2423    +2     
=======================================
+ Hits        46200    46245   +45     
  Misses        366      366           
  Partials      122      122           
Flag Coverage Δ
Autobahn 22.42% <25.00%> (-0.01%) ⬇️
CI-GHA 98.92% <100.00%> (-0.01%) ⬇️
OS-Linux 98.67% <100.00%> (-0.01%) ⬇️
OS-Windows 97.04% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.93% <100.00%> (+<0.01%) ⬆️
Py-3.10 98.15% <100.00%> (+<0.01%) ⬆️
Py-3.11 98.41% <100.00%> (+<0.01%) ⬆️
Py-3.12 98.50% <100.00%> (+<0.01%) ⬆️
Py-3.13 98.47% <100.00%> (-0.01%) ⬇️
Py-3.14 98.50% <100.00%> (+<0.01%) ⬆️
Py-3.14t 97.55% <100.00%> (-0.01%) ⬇️
Py-pypy-3.11 97.42% <100.00%> (-0.01%) ⬇️
VM-macos 97.93% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 98.67% <100.00%> (-0.01%) ⬇️
VM-windows 97.04% <100.00%> (+<0.01%) ⬆️
cython-coverage 37.92% <16.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 25, 2026

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 72 skipped benchmarks1


Comparing oppnc:codex/fix-aiohttp-localhost-addrconfig (e3c05cf) with master (7f0532c)

Open in CodSpeed

Footnotes

  1. 72 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Windows cannot connect to localhost without network

1 participant