diff --git a/asyncpg/connect_utils.py b/asyncpg/connect_utils.py index 760e1297..414231fd 100644 --- a/asyncpg/connect_utils.py +++ b/asyncpg/connect_utils.py @@ -403,7 +403,7 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user, host = ['/run/postgresql', '/var/run/postgresql', '/tmp', '/private/tmp', 'localhost'] - if not isinstance(host, list): + if not isinstance(host, (list, tuple)): host = [host] if auth_hosts is None: diff --git a/tests/test_connect.py b/tests/test_connect.py index 1af074f1..5333e2c5 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -671,6 +671,19 @@ class TestConnectParams(tb.TestCase): 'target_session_attrs': 'any', }) }, + { + 'name': 'params_multi_host_dsn_env_mix_tuple', + 'env': { + 'PGUSER': 'foo', + }, + 'dsn': 'postgresql:///db', + 'host': ('host1', 'host2'), + 'result': ([('host1', 5432), ('host2', 5432)], { + 'database': 'db', + 'user': 'foo', + 'target_session_attrs': 'any', + }) + }, { 'name': 'params_combine_dsn_settings_override_and_ssl',
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: