MCPcopy Index your code
hub / github.com/python/cpython / _is_ipv6_enabled

Function _is_ipv6_enabled

Lib/test/support/socket_helper.py:129–142  ·  view source on GitHub ↗

Check whether IPv6 is enabled on this host.

()

Source from the content-addressed store, hash-verified

127 raise unittest.SkipTest('cannot bind AF_UNIX sockets')
128
129def _is_ipv6_enabled():
130 """Check whether IPv6 is enabled on this host."""
131 if socket.has_ipv6:
132 sock = None
133 try:
134 sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
135 sock.bind((HOSTv6, 0))
136 return True
137 except OSError:
138 pass
139 finally:
140 if sock:
141 sock.close()
142 return False
143
144IPV6_ENABLED = _is_ipv6_enabled()
145

Callers 1

socket_helper.pyFile · 0.85

Calls 3

socketMethod · 0.80
bindMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…