[Python-checkins] cpython (2.7): Issue #24245: Eliminated senseless expect clauses that have no any effect in

serhiy.storchaka python-checkins at python.org
Wed May 20 15:15:49 CEST 2015


https://hg.python.org/cpython/rev/56e1d24806b3
changeset:   96168:56e1d24806b3
branch:      2.7
parent:      96163:63f0ae6e218a
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed May 20 16:14:54 2015 +0300
summary:
  Issue #24245: Eliminated senseless expect clauses that have no any effect in
IDLE.  Patch by Martin Panter.

files:
  Lib/idlelib/idle.pyw |  26 +++++++++++---------------
  Lib/idlelib/rpc.py   |   5 +----
  2 files changed, 12 insertions(+), 19 deletions(-)


diff --git a/Lib/idlelib/idle.pyw b/Lib/idlelib/idle.pyw
--- a/Lib/idlelib/idle.pyw
+++ b/Lib/idlelib/idle.pyw
@@ -2,20 +2,16 @@
     import idlelib.PyShell
 except ImportError:
     # IDLE is not installed, but maybe PyShell is on sys.path:
-    try:
-        import PyShell
-    except ImportError:
-        raise
-    else:
-        import os
-        idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
-        if idledir != os.getcwd():
-            # We're not in the IDLE directory, help the subprocess find run.py
-            pypath = os.environ.get('PYTHONPATH', '')
-            if pypath:
-                os.environ['PYTHONPATH'] = pypath + ':' + idledir
-            else:
-                os.environ['PYTHONPATH'] = idledir
-        PyShell.main()
+    import PyShell
+    import os
+    idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
+    if idledir != os.getcwd():
+        # We're not in the IDLE directory, help the subprocess find run.py
+        pypath = os.environ.get('PYTHONPATH', '')
+        if pypath:
+            os.environ['PYTHONPATH'] = pypath + ':' + idledir
+        else:
+            os.environ['PYTHONPATH'] = idledir
+    PyShell.main()
 else:
     idlelib.PyShell.main()
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -332,10 +332,7 @@
                 n = self.sock.send(s[:BUFSIZE])
             except (AttributeError, TypeError):
                 raise IOError, "socket no longer exists"
-            except socket.error:
-                raise
-            else:
-                s = s[n:]
+            s = s[n:]
 
     buffer = ""
     bufneed = 4

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


More information about the Python-checkins mailing list