Martin v. Löwis <mar...@v.loewis.de> added the comment:

> If when it caught SIGCHLD python pushed an event onto its internal
> event loop to execute the handler, I think that would make sure it's
> deferred until after the assignment.

This is not a reasonable request. How long would you want to postpone
this? Suppose somebody writes

def foo():
    local_to_launch = subprocess.Popen("/bin/echo")
    return local_to_launch

local_to_launch = foo()

then deferring the signal until after the assignment would not help,
so the semantics of your proposed change are fuzzy.

> There might be other
> consequences of that, but I'm not familiar with the interpreter
> internals. Alternatively it could be fixed with an API change -- let
> Popen return an object before it actually launches the process, and
> have a separate start() method.

The right approach is to use sigblock/sigsetmask before creating the
process, and then again after creating it. Unfortunately, these aren't
exposed from the signal module.

----------
nosy: +loewis
title: subprocess module has race condition with SIGCHLD handlers -> subprocess 
module has race condition with SIGCHLD  handlers

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to