homepage

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 vstinner
Recipients neologix, vstinner
Date 2011年07月04日.22:33:20
SpamBayes Score 1.0996534e-07
Marked as misclassified No
Message-id <1309818801.22.0.236460194103.issue12495@psf.upfronthosting.co.za>
In-reply-to
Content
InterProcessSignalTests uses 4 different signal handlers (SIGUSR1, SIGUSR2, SIGALRM, SIGHUP) and uses 2 methods to raise a signal (a subprocess executing "kill -SIG pid" or signal.alarm(1)). It uses signal.pause() and/or time.sleep(1) to wait the signal, or just nothing for SIGUSR2 (configured to be ignored).
The testcase tests too many unrelated things.
signal.alarm(1) is not an interprocess signal: it is a signal send to the process itself.
Why using two different signal handlers? A modifies a_called, B modifies b_called but raise also a Python exception. How is it related to interprocess signal handling?
Why checking that the handler A (SIGHUP) has not been called when the signal handler B (SIGUSR1) is called?
Why is the garbage collector disabled?
I propose to write a new simple testcase: install a signal handler raising a Python exception, send a signal using a child process, ensure that the signal has been received (wait for the exception). Pseudo-code:
--------
s = signal.SIGUSR1
def handler(signum, frame): 1/0
signal.signal(s, handler)
try:
 subprocess.call([sys.executable, '-c', '... kill(%s, %s)' % (os.getpid(), s))
 ... wait the signal ...
except ZeroDivisionError:
 pass
else:
 raise Exception("ZeroDivisionError not raised"
--------
The whole test has to be run in a subprocess.
The new test may pass on freebsd 6, it should be checked (see issue #12469).
History
Date User Action Args
2011年07月04日 22:33:21vstinnersetrecipients: + vstinner, neologix
2011年07月04日 22:33:21vstinnersetmessageid: <1309818801.22.0.236460194103.issue12495@psf.upfronthosting.co.za>
2011年07月04日 22:33:20vstinnerlinkissue12495 messages
2011年07月04日 22:33:20vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /