Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion Lib/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,9 @@ def has_dualstack_ipv6():
try:
with socket(AF_INET6, SOCK_STREAM) as sock:
sock.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0)
return True
# On some platforms (e.g. DragonFly BSD) setting IPV6_V6ONLY to 0
# silently has no effect, so check that it was actually cleared.
return sock.getsockopt(IPPROTO_IPV6, IPV6_V6ONLY) == 0
except error:
return False

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix :func:`socket.has_dualstack_ipv6` to return ``False`` on platforms such as
DragonFly BSD where setting ``IPV6_V6ONLY`` to 0 silently has no
effect.
Loading