def handle(sig, _):
    if sig == signal.SIGINT:
        print('SIGINT from parent!')

def disable_sig():
    """Mask the SIGINT in the child process"""
SIG_BLOCK = 0
libc.sigprocmask(SIG_BLOCK, pointer(mask), 0)
signal.signal(signal.SIGINT, handle)
pid = subprocess.Popen('./child.py', stdout=sys.stdout, stderr=sys.stdin,
    preexec_fn=disable_sig)
while 1:
    time.sleep(1)
How to stop python from propagating signals to subprocesses?