From 82935e106152ee3feebf64be854583ceee4d60e5 Mon Sep 17 00:00:00 2001 From: Kaliko Jack Date: Mon, 15 Apr 2013 21:21:14 +0200 Subject: [PATCH] Use of hasattr instead of isinstance in disconnect --- mpd.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mpd.py b/mpd.py index b504428..7c7f016 100644 --- 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() -- 2.39.5