diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-25 06:34:34 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-09-25 06:34:34 +0000 |
commit | 8f7d6cd85e68af46648ff93bf846ba95abf7dcee (patch) | |
tree | 920b4b7d8f71eecbb27c392fb49bd92add418564 /pym/_emerge | |
parent | 91901078b3d5bc198d7ca6bef062c902ed3d367e (diff) | |
download | portage-8f7d6cd85e68af46648ff93bf846ba95abf7dcee.tar.gz portage-8f7d6cd85e68af46648ff93bf846ba95abf7dcee.tar.bz2 portage-8f7d6cd85e68af46648ff93bf846ba95abf7dcee.zip |
Define __bool__() for compatibility with Python 3.
svn path=/main/trunk/; revision=14427
Diffstat (limited to 'pym/_emerge')
-rw-r--r-- | pym/_emerge/SequentialTaskQueue.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/_emerge/SequentialTaskQueue.py b/pym/_emerge/SequentialTaskQueue.py index 7dcc6e516..4909290c0 100644 --- a/pym/_emerge/SequentialTaskQueue.py +++ b/pym/_emerge/SequentialTaskQueue.py @@ -2,6 +2,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import sys from _emerge.SlotObject import SlotObject from collections import deque class SequentialTaskQueue(SlotObject): @@ -79,9 +80,11 @@ class SequentialTaskQueue(SlotObject): task.cancel() self._dirty = False - def __nonzero__(self): + def __bool__(self): return bool(self._task_queue or self.running_tasks) + if sys.hexversion < 0x3000000: + __nonzero__ = __bool__ + def __len__(self): return len(self._task_queue) + len(self.running_tasks) - |