Commit 4cdc4934 authored by Denis Bilenko's avatar Denis Bilenko

minor change

parent b6c5d887
...@@ -48,11 +48,10 @@ def sleep(seconds=0): ...@@ -48,11 +48,10 @@ def sleep(seconds=0):
methods, it's a good idea to call ``sleep(0)`` occasionally; otherwise methods, it's a good idea to call ``sleep(0)`` occasionally; otherwise
nothing else will run. nothing else will run.
""" """
hub = get_hub()
unique_mark = object() unique_mark = object()
t = core.timer(seconds, greenlet.getcurrent().switch, unique_mark) t = core.timer(seconds, getcurrent().switch, unique_mark)
try: try:
switch_result = hub.switch() switch_result = get_hub().switch()
assert switch_result is unique_mark, 'Invalid switch into sleep(): %r' % (switch_result, ) assert switch_result is unique_mark, 'Invalid switch into sleep(): %r' % (switch_result, )
finally: finally:
t.cancel() t.cancel()
......
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