Commit 5c4251ea authored by Denis Bilenko's avatar Denis Bilenko

hub.py: pass keyword arguments directly to greenlet

it seems to support them since 0.3.1
parent 6bd60794
......@@ -57,19 +57,10 @@ get_ident = thread.get_ident
MAIN_THREAD = get_ident()
def _switch_helper(function, args, kwargs):
# work around the fact that greenlet.switch does not support keyword args
return function(*args, **kwargs)
def spawn_raw(function, *args, **kwargs):
hub = get_hub()
if kwargs:
g = greenlet(_switch_helper, hub)
hub.loop.run_callback(g.switch, function, args, kwargs)
else:
g = greenlet(function, hub)
hub.loop.run_callback(g.switch, *args)
g = greenlet(function, hub)
hub.loop.run_callback(g.switch, *args, **kwargs)
return g
......
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