8000 bpo-27500: Fix sttaic ver of getaddrinfo to resolve IPv6 addresses by 1st1 · Pull Request #7993 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-27500: Fix sttaic ver of getaddrinfo to resolve IPv6 addresses #7993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactoring
  • Loading branch information
1st1 committed Jun 28, 2018
commit 3d86b5a5c946f90464aac0bf699dd159b23449f2
5 changes: 3 additions & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,6 @@ async def create_server(
raise ValueError(
'host/port and sock can not be specified at the same time')

AF_INET6 = getattr(socket, 'AF_INET6', 0)
if reuse_address is None:
reuse_address = os.name == 'posix' and sys.platform != 'cygwin'
sockets = []
Expand Down Expand Up @@ -1354,7 +1353,9 @@ async def create_server(
# Disable IPv4/IPv6 dual stack support (enabled by
# default on Linux) which makes a single socket
# listen on both address families.
if af == AF_INET6 and hasattr(socket, 'IPPROTO_IPV6'):
if (_HAS_IPv6 and
af == socket.AF_INET6 and
hasattr(socket, 'IPPROTO_IPV6')):
sock.setsockopt(socket.IPPROTO_IPV6,
socket.IPV6_V6ONLY,
True)
Expand Down
0