]> granicus.if.org Git - python/commitdiff
Issue #24245: Eliminated senseless expect clauses that have no any effect in
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 20 May 2015 13:14:54 +0000 (16:14 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Wed, 20 May 2015 13:14:54 +0000 (16:14 +0300)
IDLE.  Patch by Martin Panter.

Lib/idlelib/idle.pyw
Lib/idlelib/rpc.py

index 537dd5a9a75462f50f1463fdca315d1f9ba3d47a..9ce4c9f8a3363d475f1c6f5d1e3802574ab1ffa9 100644 (file)
@@ -2,20 +2,16 @@ try:
     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()
index 8f611a304d29ed0858e71600393558fdbc43ed26..5c4aabd8a87e9aca0f638c0f36b32ce917cb8af9 100644 (file)
@@ -332,10 +332,7 @@ class SocketIO(object):
                 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