[Python-checkins] cpython (2.7): Fix #5162. Allow child spawning from Windows services (via pywin32).

brian.curtin python-checkins at python.org
Tue Apr 12 01:01:42 CEST 2011


http://hg.python.org/cpython/rev/6507a5ba5c27
changeset:   69255:6507a5ba5c27
branch:      2.7
parent:      69244:ba699cf9bdbb
user:        brian.curtin <brian at python.org>
date:        Mon Apr 11 18:00:59 2011 -0500
summary:
  Fix #5162. Allow child spawning from Windows services (via pywin32).

files:
  Lib/multiprocessing/forking.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py
--- a/Lib/multiprocessing/forking.py
+++ b/Lib/multiprocessing/forking.py
@@ -198,6 +198,7 @@
 
     TERMINATE = 0x10000
     WINEXE = (sys.platform == 'win32' and getattr(sys, 'frozen', False))
+    WINSERVICE = sys.executable.lower().endswith("pythonservice.exe")
 
     exit = win32.ExitProcess
     close = win32.CloseHandle
@@ -207,7 +208,7 @@
     # People embedding Python want to modify it.
     #
 
-    if sys.executable.lower().endswith('pythonservice.exe'):
+    if WINSERVICE:
         _python_exe = os.path.join(sys.exec_prefix, 'python.exe')
     else:
         _python_exe = sys.executable
@@ -397,7 +398,7 @@
         if _logger is not None:
             d['log_level'] = _logger.getEffectiveLevel()
 
-        if not WINEXE:
+        if not WINEXE and not WINSERVICE:
             main_path = getattr(sys.modules['__main__'], '__file__', None)
             if not main_path and sys.argv[0] not in ('', '-c'):
                 main_path = sys.argv[0]

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list