New submission from Greg Brockman <[email protected]>:
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!
----------
components: Extension Modules
files: signals.patch
keywords: patch
messages: 113104
nosy: gdb
priority: normal
severity: normal
status: open
title: Pending signals are inherited by child processes
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7
Added file: http://bugs.python.org/file18416/signals.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue9535>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com