--- a/src/eric7/DebugClients/Python/MultiprocessingExtension.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/DebugClients/Python/MultiprocessingExtension.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,27 +19,28 @@ def patchMultiprocessing(module, debugClient): """ Function to patch the multiprocessing module. - + @param module reference to the imported module to be patched @type module @param debugClient reference to the debug client object @type DebugClient - """ # __IGNORE_WARNING_D234__ + """ # __IGNORE_WARNING_D234__ global _debugClient, _originalProcess, _originalBootstrap - + _debugClient = debugClient - + _originalProcess = module.process.BaseProcess _originalBootstrap = _originalProcess._bootstrap - + class ProcessWrapper(_originalProcess): """ Wrapper class for multiprocessing.Process. """ + def _bootstrap(self, *args, **kwargs): """ Wrapper around _bootstrap to start debugger. - + @param args function arguments @type list @param kwargs keyword only arguments @@ -48,21 +49,29 @@ @rtype int """ _debugging = False - if ( - _debugClient.debugging and - _debugClient.multiprocessSupport - ): + if _debugClient.debugging and _debugClient.multiprocessSupport: scriptName = sys.argv[0] if not _debugClient.skipMultiProcessDebugging(scriptName): _debugging = True try: - (wd, host, port, exceptions, tracePython, redirect, - noencoding) = _debugClient.startOptions[:7] + ( + wd, + host, + port, + exceptions, + tracePython, + redirect, + noencoding, + ) = _debugClient.startOptions[:7] _debugClient.startDebugger( - sys.argv[0], host=host, port=port, - exceptions=exceptions, tracePython=tracePython, - redirect=redirect, passive=False, - multiprocessSupport=True + sys.argv[0], + host=host, + port=port, + exceptions=exceptions, + tracePython=tracePython, + redirect=redirect, + passive=False, + multiprocessSupport=True, ) except Exception: print( @@ -72,12 +81,12 @@ traceback.print_exc(file=sys.stdout) sys.stdout.flush() raise - + exitcode = _originalBootstrap(self, *args, **kwargs) - + if _debugging: _debugClient.progTerminated(exitcode, "process finished") - + return exitcode - + _originalProcess._bootstrap = ProcessWrapper._bootstrap