From 6d8a122b9c0f9a8032030c208a467a4923a96266 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Mon, 17 Dec 2012 22:23:46 +0200 Subject: Issue #16704: Get rid of select.error in stdlib. Use OSError instead. --- Lib/subprocess.py | 4 ++-- Lib/telnetlib.py | 4 ++-- Lib/test/test_logging.py | 2 +- Lib/test/test_select.py | 2 +- Lib/test/test_signal.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 09c85da..ac960f9 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1614,7 +1614,7 @@ class Popen(object): raise TimeoutExpired(self.args, orig_timeout) try: ready = poller.poll(timeout) - except select.error as e: + except OSError as e: if e.args[0] == errno.EINTR: continue raise @@ -1682,7 +1682,7 @@ class Popen(object): (rlist, wlist, xlist) = \ select.select(self._read_set, self._write_set, [], timeout) - except select.error as e: + except OSError as e: if e.args[0] == errno.EINTR: continue raise diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py index a59693e..b7c57da 100644 --- a/Lib/telnetlib.py +++ b/Lib/telnetlib.py @@ -313,7 +313,7 @@ class Telnet: while i < 0 and not self.eof: try: ready = poller.poll(call_timeout) - except select.error as e: + except OSError as e: if e.errno == errno.EINTR: if timeout is not None: elapsed = time() - time_start @@ -683,7 +683,7 @@ class Telnet: while not m and not self.eof: try: ready = poller.poll(call_timeout) - except select.error as e: + except OSError as e: if e.errno == errno.EINTR: if timeout is not None: elapsed = time() - time_start diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index 54ab486..9b76055 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -773,7 +773,7 @@ if threading: """ try: asyncore.loop(poll_interval, map=self.sockmap) - except select.error: + except OSError: # On FreeBSD 8, closing the server repeatably # raises this error. We swallow it if the # server has been closed. diff --git a/Lib/test/test_select.py b/Lib/test/test_select.py index dee5921..8f9a1c9 100644 --- a/Lib/test/test_select.py +++ b/Lib/test/test_select.py @@ -32,7 +32,7 @@ class SelectTestCase(unittest.TestCase): fp.close() try: select.select([fd], [], [], 0) - except select.error as err: + except OSError as err: self.assertEqual(err.errno, errno.EBADF) else: self.fail("exception not raised") diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index c973be8..97e8d22 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -299,10 +299,10 @@ class WakeupSignalTests(unittest.TestCase): # We attempt to get a signal during the select call try: select.select([read], [], [], TIMEOUT_FULL) - except select.error: + except OSError: pass else: - raise Exception("select.error not raised") + raise Exception("OSError not raised") after_time = time.time() dt = after_time - before_time if dt >= TIMEOUT_HALF: -- cgit v0.12