Windows doesn't support inet_pton.
This commit is contained in:
parent
9e86a7b357
commit
03dedfc871
@ -93,15 +93,16 @@ def resolve(host, port=None, service=None, proto='tcp', resolver=None):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# If `host` is an IPv4 literal, we can return it immediately.
|
# If `host` is an IPv4 literal, we can return it immediately.
|
||||||
ipv4 = socket.inet_pton(socket.AF_INET, host)
|
ipv4 = socket.inet_aton(host)
|
||||||
yield (host, port)
|
yield (host, port)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Likewise, If `host` is an IPv6 literal, we can return it immediately.
|
# Likewise, If `host` is an IPv6 literal, we can return it immediately.
|
||||||
ipv6 = socket.inet_pton(socket.AF_INET6, host)
|
if hasattr(socket, 'inet_pton'):
|
||||||
yield (host, port)
|
ipv6 = socket.inet_pton(socket.AF_INET6, host)
|
||||||
|
yield (host, port)
|
||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user