[Python-checkins] cpython (2.7): Fix bug in heapq priority queue example.

georg.brandl python-checkins at python.org
Sun Sep 18 07:39:12 CEST 2011


http://hg.python.org/cpython/rev/9f3595fb6c92
changeset:   72398:9f3595fb6c92
branch:      2.7
parent:      72395:169e07315ba5
user:        Georg Brandl <georg at python.org>
date:        Sun Sep 18 07:40:05 2011 +0200
summary:
  Fix bug in heapq priority queue example.

files:
  Doc/library/heapq.rst |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst
--- a/Doc/library/heapq.rst
+++ b/Doc/library/heapq.rst
@@ -205,8 +205,8 @@
     def get_top_priority():
         while True:
             priority, count, task = heappop(pq)
-            del task_finder[task]
             if count is not INVALID:
+                del task_finder[task]
                 return task
 
     def delete_task(task):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list