mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix _compat for py3
This commit is contained in:
parent
2ebfa22f87
commit
2837bb9c17
1 changed files with 4 additions and 1 deletions
|
@ -190,7 +190,10 @@ class IPv6AddressScoped(ipaddress.IPv6Address):
|
|||
packed = False
|
||||
if isinstance(data, bytes) and len(data) == 16 and b':' not in data:
|
||||
try:
|
||||
packed = bool(int(str(bytearray(data)).encode('hex'), 16))
|
||||
if PY3:
|
||||
packed = bool(int(str(bytearray(data, 'utf-8')).encode('utf-8').hex(), 16))
|
||||
else:
|
||||
packed = bool(int(str(bytearray(data)).encode('hex'), 16))
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue