[Python-checkins] cpython (3.4): 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/f10ba5313fbb
changeset:   96169:f10ba5313fbb
branch:      3.4
parent:      96164:3a387854d106
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed May 20 16:15:02 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:
-        from . 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()
+    from . 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
@@ -340,10 +340,7 @@
                 n = self.sock.send(s[:BUFSIZE])
             except (AttributeError, TypeError):
                 raise OSError("socket no longer exists")
-            except OSError:
-                raise
-            else:
-                s = s[n:]
+            s = s[n:]
 
     buff = b''
     bufneed = 4

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


More information about the Python-checkins mailing list