From 2407dd29a6b44e96150d48ac12d0d16be2506725 Mon Sep 17 00:00:00 2001 From: Berker Peksag Date: Wed, 12 Jul 2017 17:59:08 +0300 Subject: [PATCH] select.error is a subclass of OSError since Python 3.3 --- gunicorn/arbiter.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gunicorn/arbiter.py b/gunicorn/arbiter.py index fdd4ee2f..b2949b7c 100644 --- a/gunicorn/arbiter.py +++ b/gunicorn/arbiter.py @@ -362,11 +362,10 @@ class Arbiter(object): return while os.read(self.PIPE[0], 1): pass - except select.error as e: - if e.args[0] not in [errno.EAGAIN, errno.EINTR]: - raise - except OSError as e: - if e.errno not in [errno.EAGAIN, errno.EINTR]: + except (select.error, OSError) as e: + # TODO: select.error is a subclass of OSError since Python 3.3. + errno = getattr(e, 'errno', e.args[0]) + if errno not in [errno.EAGAIN, errno.EINTR]: raise except KeyboardInterrupt: sys.exit()