diff options
| author | Raymond Hettinger <python@rcn.com> | 2006-03-25 12:15:04 (GMT) | 
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2006-03-25 12:15:04 (GMT) | 
| commit | c4e94b90a84a1127078bdb9f63707eb71fedece3 (patch) | |
| tree | 51d3913a6268f8f074a5492dd8aecc12f3033500 /Lib/Queue.py | |
| parent | ccc7bb4ef296fecb01c4cc7266dd0ca95151e893 (diff) | |
| download | cpython-c4e94b90a84a1127078bdb9f63707eb71fedece3.zip cpython-c4e94b90a84a1127078bdb9f63707eb71fedece3.tar.gz cpython-c4e94b90a84a1127078bdb9f63707eb71fedece3.tar.bz2  | |
Don't decrement below zero.  And add more tests.
Diffstat (limited to 'Lib/Queue.py')
| -rw-r--r-- | Lib/Queue.py | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/Queue.py b/Lib/Queue.py index ad65cf0..51ad354 100644 --- a/Lib/Queue.py +++ b/Lib/Queue.py @@ -56,11 +56,12 @@ class Queue:          """          self.all_tasks_done.acquire()          try: -            self.unfinished_tasks = unfinished = self.unfinished_tasks - 1 +            unfinished = self.unfinished_tasks - 1              if unfinished <= 0:                  if unfinished < 0:                      raise ValueError('task_done() called too many times')                  self.all_tasks_done.notifyAll() +            self.unfinished_tasks = unfinished          finally:              self.all_tasks_done.release()  | 
