[Pkg-mpd-commits] [python-mpd] 138/262: Fix empty callbacks

Simon McVittie smcv at debian.org
Sun May 22 18:16:38 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 49674fdb97c6b580db834f4669c3a7b9ecab219a
Author: Jörg Thalheim <jthalheim at gmail.com>
Date:   Fri Jul 6 16:37:17 2012 +0200

    Fix empty callbacks
    
    Reported by Dan
---
 mpd.py  | 3 +++
 test.py | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/mpd.py b/mpd.py
index 617a3c5..b518f93 100644
--- a/mpd.py
+++ b/mpd.py
@@ -482,6 +482,9 @@ class MPDClient():
 
 def bound_decorator(self, function):
     """ bind decorator to self """
+    if not isinstance(function, Callable):
+        return None
+
     def decorator(*args, **kwargs):
         return function(self, *args, **kwargs)
     return decorator
diff --git a/test.py b/test.py
index ad3bc3c..c1f0866 100755
--- a/test.py
+++ b/test.py
@@ -197,6 +197,11 @@ class TestMPDClient(unittest.TestCase):
     def test_numbers_as_command_args(self):
         res = self.client.find("file", 1)
 
+    def test_empty_callbacks(self):
+        self.client.close()
+        self.client._reset()
+        self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT)
+
     def test_timeout(self):
         self.client.disconnect()
         self.client.connect(TEST_MPD_HOST, TEST_MPD_PORT, timeout=5)

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