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

use getcurrent directly and not through the module

parent de4c6913
...@@ -237,7 +237,7 @@ class Waiter(object): ...@@ -237,7 +237,7 @@ class Waiter(object):
"""Wake up the greenlet that is calling wait() currently (if there is one). """Wake up the greenlet that is calling wait() currently (if there is one).
Can only be called from Hub's greenlet. Can only be called from Hub's greenlet.
""" """
assert greenlet.getcurrent() is get_hub(), "Can only use Waiter.switch method from the mainloop" assert getcurrent() is get_hub(), "Can only use Waiter.switch method from the mainloop"
if self.greenlet is not None: if self.greenlet is not None:
try: try:
self.greenlet.switch(value) self.greenlet.switch(value)
...@@ -248,7 +248,7 @@ class Waiter(object): ...@@ -248,7 +248,7 @@ class Waiter(object):
"""Make greenlet calling wait() wake up (if there is a wait()). """Make greenlet calling wait() wake up (if there is a wait()).
Can only be called from Hub's greenlet. Can only be called from Hub's greenlet.
""" """
assert greenlet.getcurrent() is get_hub(), "Can only use Waiter.switch method from the mainloop" assert getcurrent() is get_hub(), "Can only use Waiter.switch method from the mainloop"
if self.greenlet is not None: if self.greenlet is not None:
try: try:
self.greenlet.throw(*throw_args) self.greenlet.throw(*throw_args)
...@@ -260,7 +260,7 @@ class Waiter(object): ...@@ -260,7 +260,7 @@ class Waiter(object):
"""Wait until switch() or throw() is called. """Wait until switch() or throw() is called.
""" """
assert self.greenlet is None, 'This Waiter is already used by %r' % (self.greenlet, ) assert self.greenlet is None, 'This Waiter is already used by %r' % (self.greenlet, )
self.greenlet = greenlet.getcurrent() self.greenlet = getcurrent()
try: try:
return get_hub().switch() return get_hub().switch()
finally: finally:
......
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