Skip to content

Commit c999355

Browse files
committed
Decode IP addresses on Windows
1 parent 845ea48 commit c999355

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

notebook/notebookapp.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,10 @@ def _default_allow_remote(self):
857857
except ValueError:
858858
# Address is a hostname
859859
for info in socket.getaddrinfo(self.ip, self.port, 0, socket.SOCK_STREAM):
860-
addr = ipaddress.ip_address(info[4][0])
861-
if not addr.is_loopback:
860+
addr = info[4][0]
861+
if not py3compat.PY3:
862+
addr = addr.decode('ascii')
863+
if not ipaddress.ip_address(addr).is_loopback:
862864
return True
863865
return False
864866
else:

0 commit comments

Comments
 (0)