Use None instead of empty string in socket.getaddrinfo() port (#3160)

The only reason there was an empty string is python 2.7 compatibility.

Close #3144
This commit is contained in:
Alexander Kukushkin
2024-09-12 10:06:43 +02:00
committed by GitHub
parent 57ed40f66c
commit 66f98c80e8
+1 -1
View File
@@ -144,7 +144,7 @@ def validate_host_port(host_port: str, listen: bool = False, multiple_hosts: boo
for host in hosts:
# Check if "socket.IF_INET" or "socket.IF_INET6" is being used and instantiate a socket with the identified
# protocol
proto = socket.getaddrinfo(host, "", 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
proto = socket.getaddrinfo(host, None, 0, socket.SOCK_STREAM, 0, socket.AI_PASSIVE)
s = socket.socket(proto[0][0], socket.SOCK_STREAM)
try:
if s.connect_ex((host, port)) == 0: