Skip to content

Commit

Permalink
Windows Pythons don't have AF_UNIX
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanruth committed Jul 26, 2023
1 parent 98b2c5f commit a6d433f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymonetdb/mapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def try_connect(self): # noqa C901
timeout = self.target.effective_connect_timeout

sock = self.target.effective_unix_sock
if sock is not None:
if sock is not None and hasattr(socket, 'AF_UNIX'):
s = socket.socket(socket.AF_UNIX)
if timeout:
s.settimeout(float(timeout))
Expand Down Expand Up @@ -225,7 +225,7 @@ def try_connect(self): # noqa C901

if err is not None:
raise err
raise InternalError("somehow effective_unix_sock and effective_tcp_host were both None")
raise DatabaseError("endpoint not found")

def prime_or_wrap_connection(self):
if not self.target.effective_use_tls:
Expand Down

0 comments on commit a6d433f

Please sign in to comment.