[Python-Dev] Python threads end up blocking signals in subprocesses

Guido van Rossum guido at python.org
Tue Dec 23 11:11:40 EST 2003

> > How hard would it be to reimplement our own system() and popen() using
> > only POSIX calls, for POSIX systems?  I've always thought of these to
> > be pretty simple combinations of fork() and exec(), with an assumption
> > of a working /bin/sh.  
> I would be concerned that we bypass magic that the system vendor put
> into system(), which is essential for proper operation. For example,
> on Linux, system() blocks SIGINT in the parent process while the
> child is running. Also, the shell executable that system() uses
> may not be /bin/sh.

In practice, I think we can do as well as vendors -- there really
isn't that much to it.  Systems where /bin/sh doesn't exist will have
other problems...  And we get to do it right when called from a

> OTOH, using the same underlying implementation on all systems makes
> Python behave more predictable.
> In the specific case, we would not even need pthread_atfork anymore,
> as we now could invoke PyOS_AfterFork in the child ourselves.


--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list