]> granicus.if.org Git - python/commitdiff
Fix bug in heapq priority queue example.
authorGeorg Brandl <georg@python.org>
Sun, 18 Sep 2011 05:40:05 +0000 (07:40 +0200)
committerGeorg Brandl <georg@python.org>
Sun, 18 Sep 2011 05:40:05 +0000 (07:40 +0200)
Doc/library/heapq.rst

index 86be3bdf2350f3b266813a0bf5a59bb587f8b205..c995802bbdb54929bfc608f61ca216ec70f3ebb9 100644 (file)
@@ -205,8 +205,8 @@ entry as invalid and optionally add a new entry with the revised priority::
     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):