[Python-checkins] cpython: Issue #16704: Get rid of select.error in stdlib. Use OSError instead.

andrew.svetlov python-checkins at python.org
Mon Dec 17 21:23:57 CET 2012


http://hg.python.org/cpython/rev/eb8032781eba
changeset:   80920:eb8032781eba
user:        Andrew Svetlov <andrew.svetlov at gmail.com>
date:        Mon Dec 17 22:23:46 2012 +0200
summary:
  Issue #16704: Get rid of select.error in stdlib. Use OSError instead.

files:
  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
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -1614,7 +1614,7 @@
                     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 @@
                     (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
--- a/Lib/telnetlib.py
+++ b/Lib/telnetlib.py
@@ -313,7 +313,7 @@
             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 @@
             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
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -773,7 +773,7 @@
             """
             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
--- a/Lib/test/test_select.py
+++ b/Lib/test/test_select.py
@@ -32,7 +32,7 @@
             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
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -299,10 +299,10 @@
             # 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:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list