From c0aa9eeb90204b8a67a610180c003c182d1691aa Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Mon, 9 Apr 2012 01:37:19 +0200 Subject: [PATCH] Fix the patch for issue #7978: select() raises select.error before 3.3, not OSError. --- Lib/socketserver.py | 4 ++-- Lib/test/test_socketserver.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/socketserver.py b/Lib/socketserver.py index c8a8db1950e..adf9f38ead8 100644 --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -153,8 +153,8 @@ def _eintr_retry(func, *args): while True: try: return func(*args) - except OSError as e: - if e.errno != errno.EINTR: + except (OSError, select.error) as e: + if e.args[0] != errno.EINTR: raise class BaseServer: diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py index 353f8ff3d4d..ca23301cd1f 100644 --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -244,7 +244,7 @@ class SocketServerTest(unittest.TestCase): self.called += 1 if self.called == 1: # raise the exception on first call - raise OSError(errno.EINTR, os.strerror(errno.EINTR)) + raise select.error(errno.EINTR, os.strerror(errno.EINTR)) else: # Return real select value for consecutive calls return old_select(*args)