]> git.ipfire.org Git - thirdparty/Python/cpython.git/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 c8634ba29154fd415ffb82a846ee218fbf29e203..2ab632fb8ece231fa00252a8c51119c3b8017c80 100644 (file)
@@ -191,8 +191,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):