From 58b051ef6ba40b6cdaa8f3c623c36b00d0d94866 Mon Sep 17 00:00:00 2001 From: Marc Schlaich Date: Tue, 18 Apr 2017 09:38:38 +0200 Subject: [PATCH] bpo-26434: Fix multiprocessing grandchilds in a Windows service --- Lib/multiprocessing/forking.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index d393817bb34db1..9412eb1eff2610 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -405,7 +405,8 @@ def get_preparation_data(name): 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]