Issue 15507: test_subprocess assumes SIGINT is not being ignored. (original) (raw)

Created on 2012-07-30 20:35 by twouters, last changed 2022-04-11 14:57 by admin. 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) (Python triager) 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
2022-04-11 14:57:33 admin set github: 59712
2013-08-29 20:41:38 gregory.p.smith set status: open -> closedtype: behaviorassignee: gregory.p.smithnosy: + gregory.p.smithresolution: fixedstage: patch review -> resolved
2013-08-29 20:40:04 python-dev set nosy: + python-devmessages: +
2012-07-31 16:24:56 twouters set messages: +
2012-07-31 08:41:28 sbt set messages: +
2012-07-31 08:03:19 sbt set nosy: + sbtmessages: +
2012-07-30 20:47:32 twouters set files: + subprocess.patchkeywords: + patchmessages: + stage: patch review
2012-07-30 20:35:40 twouters create