Commit 193fee88 authored by Jason Madden's avatar Jason Madden

Fix some test failures under Python3.3+. This loop can also raise a...

Fix some test failures under Python3.3+. This loop can also raise a RuntimeError([Errno 9] Bad file descriptor), though, so not all are fixed. But this may be enough to fix the hang.
parent ee4514ce
...@@ -52,8 +52,11 @@ def client_loop(map): ...@@ -52,8 +52,11 @@ def client_loop(map):
try: try:
r, w, e = select.select(r, w, e, client_timeout()) r, w, e = select.select(r, w, e, client_timeout())
except select.error as err: except select.error as err:
if err[0] != errno.EINTR: # Python >= 3.3 makes select.error an alias of OSError,
if err[0] == errno.EBADF: # which is not subscriptable but does have the 'errno' attribute
err_errno = getattr(err, 'errno', None) or err[0]
if err_errno != errno.EINTR:
if err_errno == errno.EBADF:
# If a connection is closed while we are # If a connection is closed while we are
# calling select on it, we can get a bad # calling select on it, we can get a bad
......
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