Commit bbfa90ad authored by Denis Bilenko's avatar Denis Bilenko

slightly simplify Hub.wait() implementation

parent dcd24584
......@@ -287,11 +287,11 @@ class Hub(greenlet):
core.set_exc_info(exc_type, exc_value)
def wait(self, watcher):
watcher.start(getcurrent().switch, watcher, None)
unique = object()
watcher.start(getcurrent().switch, unique)
try:
result = self.switch()
assert isinstance(result, tuple) and result[0] is watcher, 'Invalid switch into %s: %r' % (getcurrent(), result)
return result
assert result is unique, 'Invalid switch into %s: %r' % (getcurrent(), result)
finally:
watcher.stop()
......
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