From: Marc Schlaich Date: Fri, 19 May 2017 00:40:16 +0000 (+0200) Subject: bpo-26434: Fix multiprocessing grandchilds in a Windows service (GH-1167) X-Git-Tag: v2.7.14rc1~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c47c315812b1fa9acb16510a7aa3b37d113def48;p=python bpo-26434: Fix multiprocessing grandchilds in a Windows service (GH-1167) Patch by Davin with help from Marc. --- diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index d393817bb3..9412eb1eff 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -405,7 +405,8 @@ else: if _logger is not None: d['log_level'] = _logger.getEffectiveLevel() - if not WINEXE and not WINSERVICE: + if not WINEXE and not WINSERVICE and \ + not d['sys_argv'][0].lower().endswith('pythonservice.exe'): main_path = getattr(sys.modules['__main__'], '__file__', None) if not main_path and sys.argv[0] not in ('', '-c'): main_path = sys.argv[0]