Commits

Anonymous committed 98676b7

Added joinall-killall-duplicate-greenlets patch.

  • Participants
  • Parent commits 97bbf05

Comments (0)

Files changed (2)

File 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)
+joinall-killall-duplicate-greenlets
 # Placed by Bitbucket