Fix for unusual kill() error that was probably introduced by a bugfix in greenlet.
This commit is contained in:
@@ -23,7 +23,7 @@ def sleep(seconds=0):
|
|||||||
occasionally; otherwise nothing else will run.
|
occasionally; otherwise nothing else will run.
|
||||||
"""
|
"""
|
||||||
hub = hubs.get_hub()
|
hub = hubs.get_hub()
|
||||||
current = greenlet.getcurrent()
|
current = getcurrent()
|
||||||
assert hub.greenlet is not current, 'do not call blocking functions from the mainloop'
|
assert hub.greenlet is not current, 'do not call blocking functions from the mainloop'
|
||||||
timer = hub.schedule_call_global(seconds, current.switch)
|
timer = hub.schedule_call_global(seconds, current.switch)
|
||||||
try:
|
try:
|
||||||
@@ -255,7 +255,8 @@ def kill(g, *throw_args):
|
|||||||
g.main(just_raise, (), {})
|
g.main(just_raise, (), {})
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if getcurrent() is not hub.greenlet:
|
current = getcurrent()
|
||||||
|
if current is not hub.greenlet:
|
||||||
# arrange to wake the caller back up immediately
|
# arrange to wake the caller back up immediately
|
||||||
hub.schedule_call_global(0,getcurrent().switch)
|
hub.schedule_call_global(0, current.switch)
|
||||||
g.throw(*throw_args)
|
g.throw(*throw_args)
|
||||||
|
@@ -193,9 +193,12 @@ class BaseHub(object):
|
|||||||
return None
|
return None
|
||||||
return t[0][0]
|
return t[0][0]
|
||||||
|
|
||||||
def run(self):
|
def run(self, *a, **kw):
|
||||||
"""Run the runloop until abort is called.
|
"""Run the runloop until abort is called.
|
||||||
"""
|
"""
|
||||||
|
# accept and discard variable arguments because they will be
|
||||||
|
# supplied if other greenlets have run and exited before the
|
||||||
|
# hub's greenlet gets a chance to run
|
||||||
if self.running:
|
if self.running:
|
||||||
raise RuntimeError("Already running!")
|
raise RuntimeError("Already running!")
|
||||||
try:
|
try:
|
||||||
|
Reference in New Issue
Block a user