summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/rpc.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2004-01-21 19:21:11 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2004-01-21 19:21:11 (GMT)
commitd6ab77d27dae87d7ffb66db0a411a631ce85a11d (patch)
treec080a0fe3271a78e7aaefdb515944b4103d8266c /Lib/idlelib/rpc.py
parentaf3eb878027954fa578f43ba490599d13215eb3a (diff)
downloadcpython-d6ab77d27dae87d7ffb66db0a411a631ce85a11d.zip
cpython-d6ab77d27dae87d7ffb66db0a411a631ce85a11d.tar.gz
cpython-d6ab77d27dae87d7ffb66db0a411a631ce85a11d.tar.bz2
rpc.py:SocketIO - Large modules were generating large pickles when downloaded
to the execution server. The return of the OK response from the subprocess initialization was interfering and causing the sending socket to be not ready. Add an IO ready test to fix this. Moved the polling IO ready test into pollpacket(). M NEWS.txt M rpc.py Backport candidate.
Diffstat (limited to 'Lib/idlelib/rpc.py')
-rw-r--r--Lib/idlelib/rpc.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py
index 90451e3..d3a9fd8 100644
--- a/Lib/idlelib/rpc.py
+++ b/Lib/idlelib/rpc.py
@@ -320,23 +320,20 @@ class SocketIO:
self.debug("putmessage:%d:" % message[0])
try:
s = pickle.dumps(message)
- except pickle.UnpicklingError:
+ except pickle.PicklingError:
print >>sys.__stderr__, "Cannot pickle:", `message`
raise
s = struct.pack("<i", len(s)) + s
while len(s) > 0:
try:
- n = self.sock.send(s)
+ r, w, x = select.select([], [self.sock], [])
+ n = self.sock.send(s[:BUFSIZE])
except (AttributeError, socket.error):
# socket was closed
raise IOError
else:
s = s[n:]
- def ioready(self, wait):
- r, w, x = select.select([self.sock.fileno()], [], [], wait)
- return len(r)
-
buffer = ""
bufneed = 4
bufstate = 0 # meaning: 0 => reading count; 1 => reading data
@@ -344,7 +341,8 @@ class SocketIO:
def pollpacket(self, wait):
self._stage0()
if len(self.buffer) < self.bufneed:
- if not self.ioready(wait):
+ r, w, x = select.select([self.sock.fileno()], [], [], wait)
+ if len(r) == 0:
return None
try:
s = self.sock.recv(BUFSIZE)
@@ -377,7 +375,7 @@ class SocketIO:
return None
try:
message = pickle.loads(packet)
- except:
+ except pickle.UnpicklingError:
print >>sys.__stderr__, "-----------------------"
print >>sys.__stderr__, "cannot unpickle packet:", `packet`
traceback.print_stack(file=sys.__stderr__)