[Pkg-mpd-commits] [python-mpd] 21/262: mpd.py: making _getitem return None if no item is returned

Simon McVittie smcv at debian.org
Sun May 22 18:16:20 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 94fd67b7f97142bda274187e463320834a58cc15
Author: J. Alexander Treuman <jat at spatialrift.net>
Date:   Sat Mar 1 15:03:47 2008 -0500

    mpd.py: making _getitem return None if no item is returned
    
    update and addid should normally always return a single item, so previously
    an exception was raised if we got nothing.  However, when used in a
    command_list, only the *last* call to update will return an item.  So
    return None instead of raising an exception if we get nothing.
---
 mpd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mpd.py b/mpd.py
index a5e1877..be8b390 100644
--- a/mpd.py
+++ b/mpd.py
@@ -225,7 +225,7 @@ class MPDClient(object):
     def _getitem(self):
         items = list(self._readitems())
         if len(items) != 1:
-            raise ProtocolError, "Expected 1 item, got %i" % len(items)
+            return
         return items[0][1]
 
     def _getlist(self):

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