Mon, 21 Feb 2022 17:39:06 +0100
Some changes to make the code clearer and a bit more robust.
--- a/eric7/APIs/Python3/eric7.api Sun Feb 20 17:38:10 2022 +0100 +++ b/eric7/APIs/Python3/eric7.api Mon Feb 21 17:39:06 2022 +0100 @@ -198,11 +198,13 @@ eric7.DataViews.PyProfileDialog.PyProfileDialog.on_buttonBox_clicked?4(button) eric7.DataViews.PyProfileDialog.PyProfileDialog.start?4(pfn, fn=None) eric7.DataViews.PyProfileDialog.PyProfileDialog?1(parent=None) +eric7.DebugClients.Python.AsyncFile.AsyncFile.BUFSIZE?7 +eric7.DebugClients.Python.AsyncFile.AsyncFile.CMD_BUFSIZE?7 +eric7.DebugClients.Python.AsyncFile.AsyncFile.MAX_TRIES?7 eric7.DebugClients.Python.AsyncFile.AsyncFile.close?4(closeit=False) eric7.DebugClients.Python.AsyncFile.AsyncFile.fileno?4() eric7.DebugClients.Python.AsyncFile.AsyncFile.flush?4() eric7.DebugClients.Python.AsyncFile.AsyncFile.isatty?4() -eric7.DebugClients.Python.AsyncFile.AsyncFile.maxtries?7 eric7.DebugClients.Python.AsyncFile.AsyncFile.pendingWrite?4() eric7.DebugClients.Python.AsyncFile.AsyncFile.read?4(size=-1) eric7.DebugClients.Python.AsyncFile.AsyncFile.readCommand?4()
--- a/eric7/DebugClients/Python/AsyncFile.py Sun Feb 20 17:38:10 2022 +0100 +++ b/eric7/DebugClients/Python/AsyncFile.py Mon Feb 21 17:39:06 2022 +0100 @@ -36,7 +36,10 @@ """ Class wrapping a socket object with a file interface. """ - maxtries = 10 + MAX_TRIES = 10 + + BUFSIZE = 2 ** 14 # 16 kBytes + CMD_BUFSIZE = 2 ** 12 # 4 kBytes def __init__(self, sock, mode, name): """ @@ -117,7 +120,7 @@ self.nWriteErrors = 0 except OSError: self.nWriteErrors += 1 - if self.nWriteErrors > self.maxtries: + if self.nWriteErrors > AsyncFile.MAX_TRIES: self.wpending = [] # delete all output self.writeLock.release() @@ -163,7 +166,7 @@ self.__checkMode('r') if size < 0: - size = 20000 + size = AsyncFile.BUFSIZE return self.sock.recv(size).decode('utf8', 'backslashreplace') @@ -195,9 +198,10 @@ length = int(length) data = b'' while len(data) < length: - newByte = self.sock.recv(1) - data += newByte - if newByte == b'\n': + remaining = length - len(data) + newBytes = self.sock.recv(min(remaining, AsyncFile.CMD_BUFSIZE)) + data += newBytes + if newBytes[-1] == b'\n': break # step 2: convert the data @@ -218,7 +222,7 @@ self.__checkMode('r') if size < 0: - size = 20000 + size = AsyncFile.BUFSIZE # The integration of the debugger client event loop and the connection # to the debugger relies on the two lines of the debugger command being
--- a/eric7/DebugClients/Python/DebugClientBase.py Sun Feb 20 17:38:10 2022 +0100 +++ b/eric7/DebugClients/Python/DebugClientBase.py Mon Feb 21 17:39:06 2022 +0100 @@ -1220,7 +1220,7 @@ while not self.eventExit: wrdy = [] - if self.writestream.nWriteErrors > self.writestream.maxtries: + if self.writestream.nWriteErrors > self.writestream.MAX_TRIES: break if AsyncPendingWrite(self.writestream): @@ -1963,6 +1963,8 @@ if progargs: if not progargs[0].startswith("-"): name = os.path.basename(progargs[0]) + elif progargs[0] == "--multiprocessing-fork": + name = "debug_client_mp-fork" else: name = "debug_client_code" else:
--- a/eric7/Debugger/DebuggerInterfacePython.py Sun Feb 20 17:38:10 2022 +0100 +++ b/eric7/Debugger/DebuggerInterfacePython.py Mon Feb 21 17:39:06 2022 +0100 @@ -138,7 +138,7 @@ @return the process object @rtype QProcess or None """ - proc = QProcess() + proc = QProcess(self) if environment is not None: env = QProcessEnvironment() for key, value in list(environment.items()):
--- a/eric7/Documentation/Source/eric7.DebugClients.Python.AsyncFile.html Sun Feb 20 17:38:10 2022 +0100 +++ b/eric7/Documentation/Source/eric7.DebugClients.Python.AsyncFile.html Mon Feb 21 17:39:06 2022 +0100 @@ -48,7 +48,7 @@ <h3>Class Attributes</h3> <table> -<tr><td>maxtries</td></tr> +<tr><td>BUFSIZE</td></tr><tr><td>CMD_BUFSIZE</td></tr><tr><td>MAX_TRIES</td></tr> </table> <h3>Class Methods</h3>