[Pkg-mpd-commits] [python-mpd] 41/262: mpd.py: adding a workaround for systems missing socket.AI_ADDRCONFIG

Simon McVittie smcv at debian.org
Sun May 22 18:16:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit 74eff57815a3308a1fafd14c1ebbcdb8714bec75
Author: J. Alexander Treuman <jat at spatialrift.net>
Date:   Mon Jun 30 15:14:10 2008 -0400

    mpd.py: adding a workaround for systems missing socket.AI_ADDRCONFIG
    
    Python on Windows doesn't define socket.AI_ADDRCONFIG.  This is likely
    because the flag is only supported by getaddrinfo() on Vista or later.
---
 mpd.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mpd.py b/mpd.py
index 5acc575..384f856 100644
--- a/mpd.py
+++ b/mpd.py
@@ -291,9 +291,13 @@ class MPDClient(object):
         if self._sock:
             raise ConnectionError("Already connected")
         msg = "getaddrinfo returns an empty list"
+        try:
+            flags = socket.AI_ADDRCONFIG
+        except AttributeError:
+            flags = 0
         for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                                       socket.SOCK_STREAM, socket.IPPROTO_TCP,
-                                      socket.AI_ADDRCONFIG):
+                                      flags):
             af, socktype, proto, canonname, sa = res
             try:
                 self._sock = socket.socket(af, socktype, proto)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list