Commits

Amaury Forgeot d'Arc  committed 5ec3a2c

_posixsubprocess: handle the (usual) case when preexec_fn is None,
and correcly call all pre- and post-fork hooks.

  • Participants
  • Parent commits 1a2ac55
  • Branches py3k

Comments (0)

Files changed (1)

File pypy/module/_posixsubprocess/interp_subprocess.py

         for i in range(len(fds_to_keep)):
             l_fds_to_keep[i] = fds_to_keep[i]
 
-        # if not space.is_none(w_preexec_fn):
-        #     _PyImport_AcquireLock()
-        preexec.space = space
-        preexec.w_preexec_fn = w_preexec_fn
+        if not space.is_none(w_preexec_fn):
+            preexec.space = space
+            preexec.w_preexec_fn = w_preexec_fn
+        else:
+            preexec.w_preexec_fn = None
 
         if not space.is_none(w_cwd):
             cwd = fsencode_w(space, w_cwd)
             l_cwd = rffi.str2charp(cwd)
+            
+        run_fork_hooks('before', space)
 
         try:
             pid = os.fork()
 
     # parent process
     finally:
-        # if not space.is_none(w_preexec_fn):
-        #     _PyImport_ReleaseLock()
         run_fork_hooks('parent', space)
         
         preexec.w_preexec_fn = None