Kristján Valur Jónsson added the comment: Caveat emptor: I know nothing of IDLE, and I even suspect it to be dead or dying code. Non the less, it could be patched.
I found this in the code: def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.PicklingError: print >>sys.__stderr__, "Cannot pickle:", repr(message) raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: r, w, x = select.select([], [self.sock], []) n = self.sock.send(s[:BUFSIZE]) except (AttributeError, TypeError): raise IOError, "socket no longer exists" except socket.error: raise else: s = s[n:] If the socket were non-blocking, this would be the place to add a handler to catch socket.error with errno=errno.EWOULDBLOCK However, I can't see that this socket is non-blocking. Perhaps I have some blindness, but the select calls seem to be redundant to me, I can't see any sock.setblocking(False) or sock.settimeout(0.0) being done anywhere. Having said that, the following change can be made (which is the prudent way to use select/send anyway) while len(s) > 0: try: while True: r, w, x = select.select([], [self.sock], []) try: n = self.sock.send(s[:BUFSIZE]) break except socket.error as e: import errno # should be done at the top if e.errno != errno.EWOULDBLOCK: raise except (AttributeError, TypeError): raise IOError, "socket no longer exists" except socket.error: raise else: s = s[n:] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26739> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com