From fc780d5a811d313e40772903dc81f0cc2319bd48 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 19 Feb 2014 16:53:03 +0100 Subject: [PATCH] [FIX] actually retry select on EINTR Turns out select has its own select.error which does *not* subclass EnvironmentError (or OSError or IOError) and does *not* have a .errno attribute. So use the correct exception, might just work better than using a completely different one with no relation. bzr revid: xmo@openerp.com-20140219155303-sgz7m3gnzr2bmani --- openerp/tests/common.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openerp/tests/common.py b/openerp/tests/common.py index 4bc13b61dbb..2f10371a8f0 100644 --- a/openerp/tests/common.py +++ b/openerp/tests/common.py @@ -197,8 +197,12 @@ class HttpCase(TransactionCase): # read a byte try: ready, _, _ = select.select([phantom.stdout], [], [], 0.5) - except EnvironmentError, e: - if e.errno == errno.EINTR: continue + except select.error, e: + # In Python 2, select.error has no relation to IOError or + # OSError, and no errno/strerror/filename, only a pair of + # unnamed arguments (matching errno and strerror) + err, _ = e.args + if err == errno.EINTR: continue raise if ready: