Commit 672d125f authored by Denis Bilenko's avatar Denis Bilenko

kill: check if greenlet is alive before doing anything

parent fca2c42f
...@@ -101,6 +101,7 @@ def kill(greenlet, exception=GreenletExit, block=False, polling_period=0.2): ...@@ -101,6 +101,7 @@ def kill(greenlet, exception=GreenletExit, block=False, polling_period=0.2):
"""Kill greenlet with exception (GreenletExit by default). """Kill greenlet with exception (GreenletExit by default).
Wait for it to die if block is true. Wait for it to die if block is true.
""" """
if not greenlet.dead:
waiter = Waiter() waiter = Waiter()
core.active_event(_kill, greenlet, exception, waiter) core.active_event(_kill, greenlet, exception, waiter)
if block: if block:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment