From a55e3f15d6d53355acae2d809e1a5c512115b0dc Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Thu, 15 Jul 2010 17:49:53 -0400 Subject: [PATCH] mpd.py: unset iterating flag if an exception is raised This fixes a bug where an MPD command error would raise an exception, but leave the iterating flag set, preventing further commands from being executed. --- mpd.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mpd.py b/mpd.py index a850bb0..380f5b1 100644 --- a/mpd.py +++ b/mpd.py @@ -275,9 +275,11 @@ class MPDClient(object): self._fetch_nothing() def _iterator_wrapper(self, iterator): - for item in iterator: - yield item - self._iterating = False + try: + for item in iterator: + yield item + finally: + self._iterating = False def _wrap_iterator(self, iterator): if not self.iterate: -- 2.39.5