Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d7faaff

Browse filesBrowse files
authored
fix: allow host tuple (#1021)
1 parent b2697ff commit d7faaff
Copy full SHA for d7faaff

File tree

Expand file treeCollapse file tree

2 files changed

+14
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-1
lines changed
Open diff view settings
Collapse file

‎asyncpg/connect_utils.py‎

Copy file name to clipboardExpand all lines: asyncpg/connect_utils.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user,
403403
host = ['/run/postgresql', '/var/run/postgresql',
404404
'/tmp', '/private/tmp', 'localhost']
405405

406-
if not isinstance(host, list):
406+
if not isinstance(host, (list, tuple)):
407407
host = [host]
408408

409409
if auth_hosts is None:
Collapse file

‎tests/test_connect.py‎

Copy file name to clipboardExpand all lines: tests/test_connect.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,19 @@ class TestConnectParams(tb.TestCase):
671671
'target_session_attrs': 'any',
672672
})
673673
},
674+
{
675+
'name': 'params_multi_host_dsn_env_mix_tuple',
676+
'env': {
677+
'PGUSER': 'foo',
678+
},
679+
'dsn': 'postgresql:///db',
680+
'host': ('host1', 'host2'),
681+
'result': ([('host1', 5432), ('host2', 5432)], {
682+
'database': 'db',
683+
'user': 'foo',
684+
'target_session_attrs': 'any',
685+
})
686+
},
674687

675688
{
676689
'name': 'params_combine_dsn_settings_override_and_ssl',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.