From: Kurt B. Kaiser Date: Wed, 19 Jan 2005 01:44:06 +0000 (+0000) Subject: Backport rpc.py rev 1.28 dating from 21Jan04 X-Git-Tag: v2.3.5c1~26 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=098d79d7f28f6b5ba7bdd97552be402e65f0944b;p=thirdparty%2FPython%2Fcpython.git Backport rpc.py rev 1.28 dating from 21Jan04 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(). Fix typo in rpc.py, s/b "pickle.PicklingError" not "pickle.UnpicklingError". idlever.py should be 1.0.4 to align with NEWS.txt. There was no IDLE release at 2.3.1 which accounts for the unsync. M NEWS.txt M idlever.py M rpc.py --- diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt index 0ffb65606d52..f1ad5060c01a 100644 --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -3,6 +3,14 @@ What's New in IDLE 1.0.4? *Release date: XX-Jan-2005* +- 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(). (Backporting rpc.py rev 1.28 21Jan04) + +- Fix typo in rpc.py, s/b "pickle.PicklingError" not "pickle.UnpicklingError". + - If an extension can't be loaded, print warning and skip it instead of erroring out. diff --git a/Lib/idlelib/idlever.py b/Lib/idlelib/idlever.py index 548bbb995a0a..1cd863b36c0e 100644 --- a/Lib/idlelib/idlever.py +++ b/Lib/idlelib/idlever.py @@ -1 +1 @@ -IDLE_VERSION = "1.0.5" +IDLE_VERSION = "1.0.4" diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py index 63e0ffa814dc..dc6c6011882d 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(" 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__)