Skip to content

Commit 0405614

Browse files
committed
refactor: simplify pending bytes checks by removing redundant try-except AttributeError
1 parent 119e474 commit 0405614

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

‎google/cloud/sql/connector/psycopg.py‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ def forward_pending() -> bool:
3939
"""
4040
if not hasattr(remote, "pending"):
4141
return False
42-
try:
43-
pending_bytes = remote.pending()
44-
except AttributeError:
45-
return False
42+
pending_bytes = remote.pending()
4643
if not isinstance(pending_bytes, int):
4744
return False
4845

@@ -62,7 +59,7 @@ def forward_pending() -> bool:
6259
return True
6360
try:
6461
pending_bytes = remote.pending()
65-
except (AttributeError, OSError):
62+
except OSError:
6663
break
6764
if not isinstance(pending_bytes, int):
6865
break

0 commit comments

Comments
 (0)