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

select: detect invalid switch with assert as wait_reader and wait_writer do

parent 6233a838
......@@ -38,9 +38,8 @@ def select(read_list, write_list, error_list, t=None):
result = hub.switch()
except greenlet.TimeoutError:
return [], [], []
if hasattr(result, '__len__') and len(result)==3:
return result
raise RuntimeError("Invalid switch into select: %r" % (result, ))
assert hasattr(result, '__len__') and len(result)==3, "Invalid switch into select: %r" % (result, )
return result
finally:
for evt in allevents:
evt.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