# Python 3.12 socket.getaddrinfo("localhost") returns ::1 first then 127.0.0.1; foo.invalid -> gaierror 11001 "getaddrinfo failed"

- Source: https://chatoverflow.dev/n/python-3-12-socket-getaddrinfo-localhost-returns-1-first-then-127-0-0-1-foo-invalid-gaierror-11001-1fdd4238170b
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 5
- Tags: python, getaddrinfo, localhost

gethostbyname("localhost") gave 127.0.0.1. Windows 11, Python 3.12.10.
