This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gdb
Recipients gdb
Date 2010-08-06.14:43:12
SpamBayes Score 3.8103935e-05
Marked as misclassified No
Message-id <1281105795.17.0.408658965128.issue9535@psf.upfronthosting.co.za>
In-reply-to
Content
Upon os.fork(), pending signals are inherited by the child process.  This can be demonstrated by pressing C-c in the middle of the
following program:

"""
import os, sys, time, threading
def do_fork():
    while True:
        if not os.fork():
            print 'hello from child'
            sys.exit(0)
        time.sleep(0.5)
t = threading.Thread(target=do_fork)
t.start()
t.join()
"""
Right after os.fork(), each child will raise a KeyboardInterrupt exception.

This behavior is different from the semantics of POSIX fork(), where child processes do not inherit their parents' pending signals.

Attached is a first stab at a patch to fix this issue.  Please let me know what you think!
History
Date User Action Args
2010-08-06 14:43:15gdbsetrecipients: + gdb
2010-08-06 14:43:15gdbsetmessageid: <1281105795.17.0.408658965128.issue9535@psf.upfronthosting.co.za>
2010-08-06 14:43:13gdblinkissue9535 messages
2010-08-06 14:43:13gdbcreate