Commit bbfa90ad authored by Denis Bilenko's avatar Denis Bilenko

slightly simplify Hub.wait() implementation

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