mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Use six to ensure unicode value
This commit is contained in:
parent
9b5d8c421b
commit
5ac8112585
1 changed files with 2 additions and 1 deletions
|
@ -10,6 +10,7 @@ import socket
|
|||
import ctypes
|
||||
import os
|
||||
import ipaddress
|
||||
import six
|
||||
|
||||
|
||||
class sockaddr(ctypes.Structure):
|
||||
|
@ -36,7 +37,7 @@ def inet_pton(address_family, ip_string):
|
|||
# This will catch IP Addresses such as 10.1.2
|
||||
if address_family == socket.AF_INET:
|
||||
try:
|
||||
ipaddress.ip_address(ip_string.encode().decode())
|
||||
ipaddress.ip_address(six.u(ip_string))
|
||||
except ValueError:
|
||||
raise socket.error('illegal IP address string passed to inet_pton')
|
||||
return socket.inet_aton(ip_string)
|
||||
|
|
Loading…
Add table
Reference in a new issue