]> kaliko git repositories - python-musicpd.git/commitdiff
Use of hasattr instead of isinstance in disconnect
authorKaliko Jack <kaliko@azylum.org>
Mon, 15 Apr 2013 19:21:14 +0000 (21:21 +0200)
committerKaliko Jack <kaliko@azylum.org>
Mon, 15 Apr 2013 19:23:04 +0000 (21:23 +0200)
mpd.py

diff --git a/mpd.py b/mpd.py
index b50442829cd05ebe94be831e2b4caacabcd5b36a..7c7f0168e615eefb914216afa1dfebab1bc4dbd3 100644 (file)
--- a/mpd.py
+++ b/mpd.py
@@ -435,14 +435,11 @@ class MPDClient(object):
             raise
 
     def disconnect(self):
-        if isinstance(self._rfile, socket._fileobject):
-            print('closing r socket')
+        if hasattr(self._rfile, 'close'):
             self._rfile.close()
-        if isinstance(self._wfile, socket._fileobject):
-            print('closing w socket')
+        if hasattr(self._wfile, 'close'):
             self._wfile.close()
         if isinstance(self._sock, socket.socket):
-            print('closing socket')
             self._sock.close()
         self._reset()