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

Martin v. Loewis martin at v.loewis.de
Tue Dec 23 04:01:58 EST 2003


Guido van Rossum wrote:

> 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.

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.

Regards,
Martin




More information about the Python-Dev mailing list