[Pkg-mpd-commits] [python-mpd] 39/262: mpd.py: catch all exceptions raised by _hello()

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 8ab007756785772039ccbc4b650366e4a191bd58
Author: J. Alexander Treuman <jat at spatialrift.net>
Date:   Thu Apr 3 00:23:36 2008 -0400

    mpd.py: catch all exceptions raised by _hello()
    
    I normally consider it bad form to catch all exceptions, since it can
    result in lost KeyboardInterrupts.  But in this case we re-raise the
    exception after cleaning up, so it's ok.
    
    While _hello() itself only raises socket.error or an MPDError subclass, a
    KeyboardInterrupt would previously go uncaught.  Since the connection was
    never cleaned up, it could be left in an unusable state.  So just
    disconnect on all exceptions instead.
---
 mpd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mpd.py b/mpd.py
index 8b70f4a..5acc575 100644
--- a/mpd.py
+++ b/mpd.py
@@ -310,7 +310,7 @@ class MPDClient(object):
         self._wfile = self._sock.makefile("wb")
         try:
             self._hello()
-        except (socket.error, MPDError):
+        except:
             self.disconnect()
             raise
 

-- 
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