1. Vadim Fint
  2. GeventPatchQueue

Source

GeventPatchQueue / joinall-killall-duplicate-greenlets

# HG changeset patch
# User mocksoul
# Parent 63e08a21e032fad45224c7f9f8054e1152964a03
Allow gevent.joinall and gevent.killall to play nice with greenlet lists containing duplicate greenlets.

diff --git a/gevent/greenlet.py b/gevent/greenlet.py
--- a/gevent/greenlet.py
+++ b/gevent/greenlet.py
@@ -500,6 +500,7 @@ def joinall(greenlets, timeout=None, rai
     queue = Queue()
     put = queue.put
     timeout = Timeout.start_new(timeout)
+    greenlets = set(greenlets)
     try:
         try:
             for greenlet in greenlets:
@@ -544,6 +545,7 @@ def _killall(greenlets, exception):
 
 
 def killall(greenlets, exception=GreenletExit, block=True, timeout=None):
+    greenlets = list(set(greenlets))
     if block:
         waiter = Waiter()
         core.active_event(_killall3, greenlets, exception, waiter)