Was passing an empty string by mistake, if no port was specified. Mostly
not a problem, except on some platforms, where it causes an
"unrecognized service" error.
Close #366.
``psycopg`` release notes
=========================
+Future releases
+---------------
+
+Psycopg 3.1.1
+^^^^^^^^^^^^^
+
+- Fix possible "unrecognized service" error in async connection when no port
+ is specified (:ticket:`#366`).
+
+
Current release
---------------
hosts_in = host_arg.split(",")
port_arg: str = str(params.get("port", os.environ.get("PGPORT", "")))
- ports_in = port_arg.split(",")
+ ports_in = port_arg.split(",") if port_arg else []
default_port = "5432"
if len(ports_in) == 1:
}
async def fake_getaddrinfo(host, port, **kwargs):
+ assert isinstance(port, int) or (isinstance(port, str) and port.isdigit())
try:
addr = fake_hosts[host]
except KeyError: