Raise an AssertionError in CompositeTask._wait() if it's detected that
authorZac Medico <zmedico@gentoo.org>
Tue, 8 Jul 2008 17:26:46 +0000 (17:26 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 8 Jul 2008 17:26:46 +0000 (17:26 -0000)
self._current_task hasn't been properly updated after calling wait on
it.

svn path=/main/trunk/; revision=10987

pym/_emerge/__init__.py

index f0a0a687cba180b8879fca98b8923c0bd1867936..c5d6c402f48fb851e09843d97aa3b29a82fda1e7 100644 (file)
@@ -1582,9 +1582,15 @@ class CompositeTask(AsynchronousTask):
                prev = None
                while True:
                        task = self._current_task
-                       if task is None or task is prev:
+                       if task is None:
                                # don't wait for the same task more than once
                                break
+                       if task is prev:
+                               # Before the task.wait() method returned, an exit
+                               # listener should have set self._current_task to either
+                               # a different task or None. Something is wrong.
+                               raise AssertionError("self._current_task has not " + \
+                                       "changed since calling wait", self, task)
                        task.wait()
                        prev = task