Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef94869

Browse files
Issue #24245: Eliminated senseless expect clauses that have no any effect in
IDLE. Patch by Martin Panter.
1 parent 5d6b7b1 commit ef94869

2 files changed

Lines changed: 12 additions & 19 deletions

File tree

Lib/idlelib/idle.pyw

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,16 @@ try:
22
import idlelib.PyShell
33
except ImportError:
44
# IDLE is not installed, but maybe PyShell is on sys.path:
5-
try:
6-
from . import PyShell
7-
except ImportError:
8-
raise
9-
else:
10-
import os
11-
idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
12-
if idledir != os.getcwd():
13-
# We're not in the IDLE directory, help the subprocess find run.py
14-
pypath = os.environ.get('PYTHONPATH', '')
15-
if pypath:
16-
os.environ['PYTHONPATH'] = pypath + ':' + idledir
17-
else:
18-
os.environ['PYTHONPATH'] = idledir
19-
PyShell.main()
5+
from . import PyShell
6+
import os
7+
idledir = os.path.dirname(os.path.abspath(PyShell.__file__))
8+
if idledir != os.getcwd():
9+
# We're not in the IDLE directory, help the subprocess find run.py
10+
pypath = os.environ.get('PYTHONPATH', '')
11+
if pypath:
12+
os.environ['PYTHONPATH'] = pypath + ':' + idledir
13+
else:
14+
os.environ['PYTHONPATH'] = idledir
15+
PyShell.main()
2016
else:
2117
idlelib.PyShell.main()

Lib/idlelib/rpc.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,7 @@ def putmessage(self, message):
340340
n = self.sock.send(s[:BUFSIZE])
341341
except (AttributeError, TypeError):
342342
raise OSError("socket no longer exists")
343-
except OSError:
344-
raise
345-
else:
346-
s = s[n:]
343+
s = s[n:]
347344

348345
buff = b''
349346
bufneed = 4

0 commit comments

Comments
 (0)