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