Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions asyncpg/connect_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,14 @@ async def __connect_addr(
except (
exceptions.InvalidAuthorizationSpecificationError,
exceptions.ConnectionDoesNotExistError, # seen on Windows
):
) as exc:
tr.close()


# Do not retry on wrong password (28P01) — the issue is credentials,
# not SSL negotiation. Only pg_hba.conf rejections (28000) warrant a retry.
if isinstance(exc, exceptions.InvalidPasswordError):
raise

# retry=True here is a redundant check because we don't want to
# accidentally raise the internal _RetryConnectSignal to the user
if retry and (
Expand Down