classification
Title: test_subprocess assumes SIGINT is not being ignored.
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4, Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: gregory.p.smith, python-dev, sbt, twouters
Priority: normal Keywords: patch

Created on 2012-07-30 20:35 by twouters, last changed 2013-08-29 20:41 by gregory.p.smith. This issue is now closed.

Files
File name Uploaded Description Edit
subprocess.patch twouters, 2012-07-30 20:47 review
Messages (6)
msg166921 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2012-07-30 20:35
test_subprocess's test_send_signal assumes SIGINT is not being ignored, by spawning a new process and expecting it to have the default SIGINT handler . SIGINT can be set to SIG_IGN if the process running the test inherited it from the parent process.
msg166922 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2012-07-30 20:47
Patch attached to (briefly) set signal.SIGINT to the default in the test.

It may make sense to add a feature to subprocess.Popen to ignore/unignore signals (it should only need to support SIG_DFL and SIG_IGN, not other signal handlers, considering there'll be an exec right after.)
msg166973 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-31 08:03
Couldn't the preexec_fn argument of Popen be used instead?
msg166982 - (view) Author: Richard Oudkerk (sbt) * (Python committer) Date: 2012-07-31 08:41
> Couldn't the preexec_fn argument of Popen be used instead?

Actually, since Python 3.2 you can just use "restore_signals=True".
msg167014 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2012-07-31 16:24
No, using preexec_fn leaves all kinds of races when mixing threads and processes (which is a bad idea, but people still sometimes do.) And no, restore_signals doesn't fix this; restore_signals only resets the signals the *Python interpreter itself* ignored: SIGFPE, SIGXFZ and SIGFSZ (and it defaults to True anyway.) It doesn't affect other signals at all, even if Python code ignored them.
msg196489 - (view) Author: Roundup Robot (python-dev) Date: 2013-08-29 20:40
New changeset 9810844126e1 by Gregory P. Smith in branch '3.3':
Fixes issue #15507: test_subprocess's test_send_signal could fail if the test
http://hg.python.org/cpython/rev/9810844126e1

New changeset 6aa7ca40b100 by Gregory P. Smith in branch 'default':
Fixes Issue #15507: test_subprocess's test_send_signal could fail if the test
http://hg.python.org/cpython/rev/6aa7ca40b100
History
Date User Action Args
2013-08-29 20:41:38gregory.p.smithsetstatus: open -> closed

type: behavior
assignee: gregory.p.smith
nosy: + gregory.p.smith
resolution: fixed
stage: patch review -> resolved
2013-08-29 20:40:04python-devsetnosy: + python-dev
messages: + msg196489
2012-07-31 16:24:56twouterssetmessages: + msg167014
2012-07-31 08:41:28sbtsetmessages: + msg166982
2012-07-31 08:03:19sbtsetnosy: + sbt
messages: + msg166973
2012-07-30 20:47:32twouterssetfiles: + subprocess.patch
keywords: + patch
messages: + msg166922

stage: patch review
2012-07-30 20:35:40twouterscreate